尝试安装ng-bootstrap时出错,包安装失败

问题描述 投票:0回答:0

我正在开发一个 Angular 应用程序,为此我需要一个手风琴。我试图通过运行命令“ng add @ng-bootstrap/ng-bootstrap”来安装 ng-bootstrap 包,但每次我尝试运行它时,安装都会失败。我已经解决了 Stack Overflow 上提出的几乎所有类似问题,并尝试使用他们的解决方案,但无济于事,而且开始变得有点令人沮丧。如果有人知道是什么导致了这一切,请告诉我,我们将不胜感激。完整错误信息如下:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"15.2.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/animations
npm ERR!     peerOptional @angular/animations@"15.2.0" from @angular/[email protected]
npm ERR!     node_modules/@angular/platform-browser
npm ERR!       peer @angular/platform-browser@"15.2.0" from @angular/[email protected]
npm ERR!       node_modules/@angular/forms
npm ERR!         @angular/forms@"^15.2.0" from the root project
npm ERR!       3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!     @angular/animations@"^15.2.0" from the root project
npm ERR!   peer @angular/core@"15.2.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/common
npm ERR!     peer @angular/common@"15.2.0" from @angular/[email protected]
npm ERR!     node_modules/@angular/forms
npm ERR!       @angular/forms@"^15.2.0" from the root project
npm ERR!     peer @angular/common@"15.2.0" from @angular/[email protected]
npm ERR!     node_modules/@angular/platform-browser
npm ERR!       peer @angular/platform-browser@"15.2.0" from @angular/[email protected]
npm ERR!       node_modules/@angular/forms
npm ERR!         @angular/forms@"^15.2.0" from the root project
npm ERR!       3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!     4 more (@angular/platform-browser-dynamic, @angular/router, ...)
npm ERR!   7 more (@angular/compiler, @angular/forms, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! @ng-bootstrap/ng-bootstrap@"14.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/core
npm ERR!   peer @angular/core@"15.2.7" from @angular/[email protected]
npm ERR!   node_modules/@angular/forms
npm ERR!     @angular/forms@"^15.2.0" from the root project
npm ERR!     peer @angular/forms@"^15.0.0" from @ng-bootstrap/[email protected]
npm ERR!     node_modules/@ng-bootstrap/ng-bootstrap
npm ERR!       @ng-bootstrap/ng-bootstrap@"14.1.0" 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 /Users/tazar/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tazar/.npm/_logs/2023-04-15T04_02_08_353Z-debug.log`

I attempted to run "ng update" & "npm i -g @angular/cli" to update the dependencies within my project, but nothing worked. I'm also not good with fixing dependencies at all, so Im a bit lost and am not sure what to do. 
angular angularjs npm angular-cli angular-ui-bootstrap
© www.soinside.com 2019 - 2024. All rights reserved.