Bootstrap无法通过命令提示符安装Angular 6项目

时间:2019-03-07 18:40:10

标签: angular6

npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.3.1 requires a peer of popper.js@^1.14.7 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ bootstrap@4.3.1
updated 1 package and audited 40445 packages in 18.647s
found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

给出安装引导程序的命令后,我得到了这个。而且我也已签入节点模块文件夹,但尚未安装。谁能帮我

2 个答案:

答案 0 :(得分:0)

您可以手动将其添加到package.json文件中。

"dependencies": {

"bootstrap": "^4.3.1",

},

在package.json文件中,您可以找到依赖项,然后添加此内容。

答案 1 :(得分:0)

要解决此问题,只需使用npm手动安装那些软件包:

npm install ajv

npm install jquery

npm install popper.js

现在您已经拥有所有需要的软件包。


要正确运行boostrap,请执行以下步骤:

  1. 通过添加jquery popper和bootstrap脚本,打开angular.json文件并编辑脚本部分,如下所示:
  

“脚本”:[“ node_modules / jquery / dist / jquery.min.js”,
  “ node_modules / popper.js / dist / umd / popper.min.js”,
  “ node_modules / bootstrap / dist / js / bootstrap.bundle.js”]

  1. 打开src / styles.css文件并添加boostrap css导入:
  

@import'〜bootstrap / dist / css / bootstrap.min.css';