Home > Back-end >  Error installing Bootstrap (Ngb Module) in Angular
Error installing Bootstrap (Ngb Module) in Angular

Time:11-25

I want to install Ngb in Angular. I use n Node.js version v19.1.0. I already tried --force and --legacy-pear-drops. Also i tried reinstalling Node.js.

The log: `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@"14.2.2" from @angular/[email protected] npm ERR! node_modules/@angular/animations npm ERR! peerOptional @angular/animations@"14.2.2" from @angular/[email protected] npm ERR! node_modules/@angular/platform-browser npm ERR! peer @angular/platform-browser@"14.2.2" 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/platform-browser-dynamic, @angular/router, the root project) npm ERR! @angular/animations@"^14.1.0" from the root project npm ERR! peer @angular/core@"14.2.2" from @angular/[email protected] npm ERR! node_modules/@angular/common npm ERR! peer @angular/common@"14.2.2" 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/common@"14.2.2" from @angular/[email protected] npm ERR! node_modules/@angular/platform-browser npm ERR! peer @angular/platform-browser@"14.2.2" 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/platform-browser-dynamic, @angular/router, the root project) npm ERR! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project) npm ERR! 6 more (@angular/compiler, @angular/forms, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! @ng-bootstrap/ng-bootstrap@"13.1.1" 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.12" 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.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 C:\Users\thomas\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\thomas\AppData\Local\npm-cache_logs\2022-11-24T10_07_23_103Z-debug-0.log × Packages installation failed, see above.`

I expected installs Bootstrap

CodePudding user response:

First try npm config set legacy-peer-deps true. Maybe you must also run npm audit fix See also angular bootstrap is giving error on angular 13 project

CodePudding user response:

I strongly recommend using Angular CLI for setting up a new project. If you have an Angular ≥ 9 CLI project.

Just run the following:

ng add @ng-bootstrap/ng-bootstrap

It will install ng-bootstrap for the default application specified in your angular.json. If you have multiple projects and you want to target a specific application, you could specify the --project option

ng add @ng-bootstrap/ng-bootstrap --project myProject
  • Related