A. Wheatman
A. Wheatman

Reputation: 6396

Can't install ng-bootstrap with latest Angular 14

I'm trying to install ng-bootstrap with latest Angular 14 with command

ng add @ng-bootstrap/ng-bootstrap

and getting this error

PS C:\Dev\Angular\my-app> ng add @ng-bootstrap/ng-bootstrap --force
ℹ Using package manager: npm
✔ Found compatible package version: @ng-bootstrap/[email protected].
✔ Package information loaded.

The package @ng-bootstrap/[email protected] will be installed and executed.
Would you like to proceed? Yes
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@">=2.0.0 || >=4.0.0 || >=5.0.0" from [email protected]
npm ERR!   node_modules/angular-font-awesome
npm ERR!     angular-font-awesome@"^3.1.2" from the root project
npm ERR!   peer @angular/core@"14.1.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/animations
npm ERR!     peerOptional @angular/animations@"14.1.0" from @angular/[email protected]
npm ERR!     node_modules/@angular/platform-browser
npm ERR!       peer @angular/platform-browser@"14.1.0" from @angular/[email protected]
npm ERR!       node_modules/@angular/forms
npm ERR!         @angular/forms@"^14.1.0" from the root project
npm ERR!       3 more (@angular/router, @angular/platform-browser-dynamic, the root project)
npm ERR!     @angular/animations@"^14.1.0" from the root project
npm ERR!   7 more (@angular/common, @angular/compiler, @angular/forms, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @ng-bootstrap/ng-bootstrap@"13.0.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@"14.2.6" from @angular/[email protected]
npm ERR!   node_modules/@angular/forms
npm ERR!     @angular/forms@"^14.1.0" from the root project
npm ERR!     peer @angular/forms@"^14.1.0" from @ng-bootstrap/[email protected]
npm ERR!     node_modules/@ng-bootstrap/ng-bootstrap
npm ERR!       @ng-bootstrap/ng-bootstrap@"13.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 C:\Users\aw\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\aw\AppData\Local\npm-cache\_logs\2022-10-14T18_32_47_956Z-debug-0.log
✖ Packages installation failed, see above.

tried the same command with --force but result is the same.

Any ideas what am I doing wrong and how to fix it?

Upvotes: 0

Views: 1610

Answers (1)

Vasileios Kagklis
Vasileios Kagklis

Reputation: 826

Do you have mixed versions in your package.json? In the log you provided I see both 14.1.0 and 14.2.6 versions. I would make sure all versions are aligned in package.json. Then delete node_modules and retry npm install.

Upvotes: 1

Related Questions