简体   繁体   中英

Error : installing ng add @ng-bootstrap/ng-bootstrap

i would like to install ng-bootstrap in my angular project, it's giving me this error:

    PS C:\xampp\htdocs\SNCF\Angular-SNCF> ng add @ng-bootstrap/ng-bootstrap
ℹ Using package manager: npm
⚠ Unable to find compatible package. Using 'latest' tag.
⚠ Package has unmet peer dependencies. Adding the package may not succeed.

The package @ng-bootstrap/ng-bootstrap@12.1.2 will be installed and executed.
Would you like to proceed? Yes
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree       
npm ERR!
npm ERR! While resolving: angular-sncf@0.0.0
npm ERR! Found: @angular/common@14.0.5
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^14.0.5" from the root project
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^13.0.0" from @ng-bootstrap/ng-bootstrap@12.1.2
npm ERR! node_modules/@ng-bootstrap/ng-bootstrap
npm ERR!   @ng-bootstrap/ng-bootstrap@"12.1.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 C:\Users\hp\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hp\AppData\Local\npm-cache\_logs\2022-07-13T15_17_41_606Z-debug-0.log
✖ Packages installation failed, see above.

i tried also this: npm i @ng-bootstrap/ng-bootstrap ---> it's giving me the same error

and this: npm i @ng-bootstrap/ng-bootstrap --legacy-peer-deps ---> it's giving me the same error

and this: npm i @ng-bootstrap/ng-bootstrap --force ---> it's giving me the same error

i tried to update angular: ng update @angular/cli @angular/core

But still not working

尝试删除您的 node_modules 文件夹和您的 npm 缓存,然后重试

the Message say to you use angular version @14.0.5 it's not compatible with ng-bootstrap version

solution is: use @angular/cli@13.0.0 @ng-bootstrap/ng-bootstrap@12.1.2

compatibility table: https://ng-bootstrap.github.io/#/getting-started

now, to sol this problem i used: npm i -g @angular/cli@14.1.0 and ng add @ng-bootstrap/ng-bootstrap@13.1.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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