我想安装ng-Bootstrap并使用命令ng add @ng-bootstrap/ng-bootstrap@11.0.0-beta.2
来获取与bootstrap 5和angular 12兼容的最新beta版本。
但是当运行这个命令时,控制台中会弹出那些错误消息:
ℹ Using package manager: npm
✔ Package information loaded.
The package @ng-bootstrap/ng-bootstrap@11.0.0-beta.2 will be installed and executed.
Would you like to proceed? Yes
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: simplefileshare@0.0.0
npm ERR! Found: @angular/core@12.2.7
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"12.2.7" from @angular/animations@12.2.7
npm ERR! node_modules/@angular/animations
npm ERR! peerOptional @angular/animations@"12.2.7" from @angular/platform-browser@12.2.7
npm ERR! node_modules/@angular/platform-browser
npm ERR! peer @angular/platform-browser@"12.2.7" from @angular/forms@12.2.7
npm ERR! node_modules/@angular/forms
npm ERR! @angular/forms@"~12.2.0" from the root project
npm ERR! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR! @angular/animations@"~12.2.0" from the root project
npm ERR! peer @angular/core@"12.2.7" from @angular/common@12.2.7
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"12.2.7" from @angular/forms@12.2.7
npm ERR! node_modules/@angular/forms
npm ERR! @angular/forms@"~12.2.0" from the root project
npm ERR! peer @angular/common@"12.2.7" from @angular/platform-browser@12.2.7
npm ERR! node_modules/@angular/platform-browser
npm ERR! peer @angular/platform-browser@"12.2.7" from @angular/forms@12.2.7
npm ERR! node_modules/@angular/forms
npm ERR! @angular/forms@"~12.2.0" from the root project
npm ERR! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR! 5 more (@angular/forms, @angular/platform-browser, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @ng-bootstrap/ng-bootstrap@"11.0.0-beta.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/core@12.2.8
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"12.2.8" from @angular/forms@12.2.8
npm ERR! node_modules/@angular/forms
npm ERR! @angular/forms@"~12.2.0" from the root project
npm ERR! peer @angular/forms@"^12.0.0" from @ng-bootstrap/ng-bootstrap@11.0.0-beta.2
npm ERR! node_modules/@ng-bootstrap/ng-bootstrap
npm ERR! @ng-bootstrap/ng-bootstrap@"11.0.0-beta.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-10-04T08_36_31_463Z-debug.log
✖ Package install failed, see above.
我在这里错过了什么?我确实用npm安装了bootstrap 5并将其添加到angular.json中。我还需要做什么吗?
编辑:
这些都是我的依赖:
"dependencies": {
"-": "^0.0.1",
"@angular/animations": "~12.2.0",
"@angular/common": "~12.2.0",
"@angular/compiler": "~12.2.0",
"@angular/core": "~12.2.0",
"@angular/forms": "~12.2.0",
"@angular/platform-browser": "~12.2.0",
"@angular/platform-browser-dynamic": "~12.2.0",
"@angular/router": "~12.2.0",
"@popperjs/core": "^2.10.1",
"bootstrap": "^5.0.0-beta3",
"rxjs": "~6.6.0",
"save": "^2.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
}
3条答案
按热度按时间vvppvyoh1#
我也遇到了同样的问题。看起来
ng-bootstrap
包中的依赖项有些不正确,因为它们不允许Angular〉12.0.x。对我有效的方法:
这将确保在强制安装软件包之前,所有依赖项都是最新的。一旦安装了软件包,我们仍然会运行原理图,以确保所有应用程序文件都被正确修补。
bn31dyow2#
尝试
然后试着逃跑
yhived7q3#
我也有同样的问题。
对我有效的方法:一个月一个月一个月一个月一个月