som*_*334 4 npm ng-bootstrap angular
我想安装ng-Bootstrap并使用该命令ng add @ng-bootstrap/ng-bootstrap@11.0.0-beta.2获取与 bootstrap 5 和 Angular 12 兼容的最新测试版。
但是,当运行此命令时,控制台中会弹出这些错误消息:
\n\xe2\x84\xb9 Using package manager: npm\n\xe2\x9c\x94 Package information loaded.\n \nThe package @ng-bootstrap/ng-bootstrap@11.0.0-beta.2 will be installed and executed.\nWould you like to proceed? Yes\nnpm ERR! code ERESOLVE\nnpm ERR! ERESOLVE could not resolve\nnpm ERR! \nnpm ERR! While resolving: simplefileshare@0.0.0\nnpm ERR! Found: @angular/core@12.2.7\nnpm ERR! node_modules/@angular/core\nnpm ERR! peer @angular/core@"12.2.7" from @angular/animations@12.2.7\nnpm ERR! node_modules/@angular/animations\nnpm ERR! peerOptional @angular/animations@"12.2.7" from @angular/platform-browser@12.2.7\nnpm ERR! node_modules/@angular/platform-browser\nnpm ERR! peer @angular/platform-browser@"12.2.7" from @angular/forms@12.2.7\nnpm ERR! node_modules/@angular/forms\nnpm ERR! @angular/forms@"~12.2.0" from the root project\nnpm ERR! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project)\nnpm ERR! @angular/animations@"~12.2.0" from the root project\nnpm ERR! peer @angular/core@"12.2.7" from @angular/common@12.2.7\nnpm ERR! node_modules/@angular/common\nnpm ERR! peer @angular/common@"12.2.7" from @angular/forms@12.2.7\nnpm ERR! node_modules/@angular/forms\nnpm ERR! @angular/forms@"~12.2.0" from the root project\nnpm ERR! peer @angular/common@"12.2.7" from @angular/platform-browser@12.2.7\nnpm ERR! node_modules/@angular/platform-browser\nnpm ERR! peer @angular/platform-browser@"12.2.7" from @angular/forms@12.2.7\nnpm ERR! node_modules/@angular/forms\nnpm ERR! @angular/forms@"~12.2.0" from the root project\nnpm ERR! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project)\nnpm ERR! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project)\nnpm ERR! 5 more (@angular/forms, @angular/platform-browser, ...)\nnpm ERR! \nnpm ERR! Could not resolve dependency:\nnpm ERR! @ng-bootstrap/ng-bootstrap@"11.0.0-beta.2" from the root project\nnpm ERR! \nnpm ERR! Conflicting peer dependency: @angular/core@12.2.8\nnpm ERR! node_modules/@angular/core\nnpm ERR! peer @angular/core@"12.2.8" from @angular/forms@12.2.8\nnpm ERR! node_modules/@angular/forms\nnpm ERR! @angular/forms@"~12.2.0" from the root project\nnpm ERR! peer @angular/forms@"^12.0.0" from @ng-bootstrap/ng-bootstrap@11.0.0-beta.2\nnpm ERR! node_modules/@ng-bootstrap/ng-bootstrap\nnpm ERR! @ng-bootstrap/ng-bootstrap@"11.0.0-beta.2" from the root project\nnpm ERR! \nnpm ERR! Fix the upstream dependency conflict, or retry\nnpm ERR! this command with --force, or --legacy-peer-deps\nnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.\nnpm ERR! \nnpm ERR! See /root/.npm/eresolve-report.txt for a full report.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /root/.npm/_logs/2021-10-04T08_36_31_463Z-debug.log\n\xe2\x9c\x96 Package install failed, see above.\nRun Code Online (Sandbox Code Playgroud)\n我在这里想念什么?我确实使用 npm 安装了 bootstrap 5 并将其添加到 angular.json 中。我还需要做些什么吗?
\n编辑:
\n这些是我的所有依赖项:
\n"dependencies": {\n "-": "^0.0.1",\n "@angular/animations": "~12.2.0",\n "@angular/common": "~12.2.0",\n "@angular/compiler": "~12.2.0",\n "@angular/core": "~12.2.0",\n "@angular/forms": "~12.2.0",\n "@angular/platform-browser": "~12.2.0",\n "@angular/platform-browser-dynamic": "~12.2.0",\n "@angular/router": "~12.2.0",\n "@popperjs/core": "^2.10.1",\n "bootstrap": "^5.0.0-beta3",\n "rxjs": "~6.6.0",\n "save": "^2.4.0",\n "tslib": "^2.3.0",\n "zone.js": "~0.11.4"\n }\nRun Code Online (Sandbox Code Playgroud)\n
小智 13
我遇到过同样的问题。这看起来ng-bootstrap包中的依赖项有些不正确,因为它们不允许 Angular > 12.0.x。
对我有用的:
npm update
npm install --save --legacy-peer-deps @ng-bootstrap/ng-bootstrap
ng add @ng-bootstrap/ng-bootstrap
Run Code Online (Sandbox Code Playgroud)
这将确保在强制安装包之前所有依赖项都是最新的。安装软件包后,我们仍然运行原理图以确保所有应用程序文件都已正确修补。
| 归档时间: |
|
| 查看次数: |
10536 次 |
| 最近记录: |