简体   繁体   English

无法使用 Angular 和对等 js 安装 ng-boostrap

[英]Can't intall ng-boostrap with Angular and peer js

I am trying to install ng bootstrap on an angular project.我正在尝试在 angular 项目上安装 ng bootstrap。 But when I do, I get the following error:但是当我这样做时,我收到以下错误:

An unhandled exception occurred: npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: test@0.0.0
npm ERR! Found: @angular/compiler@10.1.6
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"~10.1.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"10.2.4" from @angular/localize@10.2.4
npm ERR! node_modules/@angular/localize
npm ERR!   peer @angular/localize@"^10.0.0" from @ng-bootstrap/ng-bootstrap@8.0.4
npm ERR!   node_modules/@ng-bootstrap/ng-bootstrap
npm ERR!     @ng-bootstrap/ng-bootstrap@"8.0.4" 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.

But on another project, the installation went well.但在另一个项目中,安装进展顺利。 Can someone explain to me how to fix this problem?有人可以向我解释如何解决这个问题吗?

I was able to solve the problem.我能够解决这个问题。 I put my solution in case someone has the same problem.我提出我的解决方案,以防有人遇到同样的问题。 I first updated angular core with ng update @angular/cli @angular/core .我首先使用ng update @angular/cli @angular/core更新了 angular 核心。 Since I had ng-starrating installed, I uninstalled it with npm uninstall ng-starrating .由于我安装了 ng-starrating ,因此我使用npm uninstall ng-starrating卸载了它。 And finally I added ng-bootstrap with ng add @ ng-bootstrap / ng-bootstrap .最后我用ng add @ ng-bootstrap / ng-bootstrap And everything is going well.一切进展顺利。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM