Home > Blockchain >  How can I install @ng-bootstrap/ng-bootstrap on Angular 15?
How can I install @ng-bootstrap/ng-bootstrap on Angular 15?

Time:12-04

Trying both ng install or npm install fails:

The package @ng-bootstrap/[email protected] 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: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^15.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^14.1.0" from @ng-bootstrap/[email protected]
npm ERR! node_modules/@ng-bootstrap/ng-bootstrap
npm ERR!   @ng-bootstrap/ng-bootstrap@"13.1.1" 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 /home/node/.npm/eresolve-report.txt for a full report.


$ npm install @ng-bootstrap/ng-bootstrap
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^15.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^14.1.0" from @ng-bootstrap/[email protected]
npm ERR! node_modules/@ng-bootstrap/ng-bootstrap
npm ERR!   @ng-bootstrap/ng-bootstrap@"*" 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 /home/node/.npm/eresolve-report.txt for a full report.

CodePudding user response:

skip the dependency tree checking.

npm install @ng-bootstrap/ng-bootstrap --legacy-peer-deps

CodePudding user response:

It seems like it is a version incompatibility issue.

To fix this issue, you need to update the @angular/common package in your Angular project to the version that is compatible with the @ng-bootstrap/ng-bootstrap package.

  1. Open a terminal window and navigate to the root directory of your Angular project.

  2. Run the following command to update the @angular/common package to the version that is compatible with the @ng-bootstrap/ng-bootstrap package:

npm install --save @angular/[email protected]

  • Related