首页 > 解决方案 > 在角度 11 中安装 ng-bootstrap 时出错

问题描述

我已经安装了 Angular cli 的版本 (11),并且在安装 ng-bootstrap 时收到以下错误消息。有人可以帮我解决这个问题吗?

SeshagiiRaosMBP:trx-mngmt-ui-10 Munuma$ 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.
An unhandled exception occurred: npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: trx-mngmt-ui@0.0.0
npm ERR! Found: @angular/core@11.0.5
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"~11.0.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"10.0.14" from @angular/common@10.0.14
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"~10.0.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/Munuma/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Munuma/.npm/_logs/2020-12-29T14_49_36_751Z-debug.log
Package install failed, see above.
See "/private/var/folders/m1/g43nd64x54qdm_94_wk1sc7m0000gn/T/ng-fL8ZaZ/angular-errors.log" for further details.

标签: angularng-bootstrap

解决方案


运行npm i @ng-bootstrap/ng-bootstrap --legacy-peer-deps解决问题


推荐阅读