【问题标题】:Angular `npm install save --bootstrap` doesn't install bootstrap moduleAngular `npm install save --bootstrap` 不安装引导模块
【发布时间】:2020-10-16 13:53:24
【问题描述】:

我需要在一个新的 Angular 项目中安装引导模块。

npm install save --bootstrap

输出如下,并且引导模块未安装在 node_modules 中。

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ save@2.4.0
updated 1 package and audited 1467 packages in 5.145s

55 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

之前的成功安装表明至少应该添加 10+ 个包。但上面的输出表明只更新了 1 个包?

有人可以帮忙解决问题吗?

【问题讨论】:

    标签: angular angular-ui-bootstrap node-modules npm-install


    【解决方案1】:

    这就是我的安装方式:

    npm install bootstrap jquery popper.js --save-dev
    

    然后编辑 angular.json

    "./node_modules/bootstrap/dist/css/bootstrap.min.css"
    

    和

    "./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
    

    【讨论】:

    • 难以置信!同样,这个错误整天都在伤害我:$ ng add @ng-bootstrap/ng-bootstrap Unable to find compatible package. Using 'latest'. Package has unmet peer dependencies. Adding the package may not succeed. Installing packages for tooling via npm. Installed packages for tooling via npm. An unhandled exception occurred: Cannot find module '@schematics/angular/utility/project'
    • 你确定你 cd'd 到你的项目文件夹吗?
    • 是的,肯定的。我还确认安装了bootstrap 模块并在安装ng-bootstrap 之前更新了angular.json。很奇怪……
    • 那么什么有效? 3个cmets说不行,然后点“解决”按钮?
    • 您的帖子适用于bootstrap 安装。如果您仔细观察,致命问题是ng-bootstrap 安装。请看我的帖子:https://stackoverflow.com/questions/62587172/angular-install-ng-bootstrap-cannot-find-module-schematics-angular-utility-pr/62601614#62601614。 https://github.com/ng-bootstrap/ng-bootstrap/issues/3788。感谢您的及时回复!
    猜你喜欢
    • 2019-05-09
    • 1970-01-01
    • 2016-12-12
    • 2022-01-06
    • 2020-09-25
    • 1970-01-01
    • 2016-02-21
    • 2023-02-16
    • 2018-07-30
    相关资源
    最近更新 更多