Home > Software design >  Error Adding Bootstrap Into Angular Project
Error Adding Bootstrap Into Angular Project

Time:01-14

Trying to run this in my Angular project

ng add @ng-bootstrap/ng-bootstrap

Get this error though and don't know how to fix

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/compiler
npm ERR!   @angular/compiler@"^15.0.0" from the root project
npm ERR!   peer @angular/compiler@"15.0.4" from @angular/[email protected]
npm ERR!   node_modules/@angular/compiler-cli
npm ERR!     dev @angular/compiler-cli@"^15.0.0" from the root project
npm ERR!     peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/[email protected]
npm ERR!     node_modules/@angular-devkit/build-angular
npm ERR!       dev @angular-devkit/build-angular@"^15.0.4" from the root project
npm ERR!     1 more (@ngtools/webpack)
npm ERR!   1 more (@angular/platform-browser-dynamic)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular/localize@"^15.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/compiler
npm ERR!   peer @angular/compiler@"15.1.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/localize
npm ERR!     dev @angular/localize@"^15.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.

✖ Package install failed, see above.
The Schematic workflow failed. See above.

CodePudding user response:

I think you can try to delete "node_modules" folder and "package-lock.json" as well, and then run npm i

CodePudding user response:

Install bootstrap using npm : npm i bootstrap . And then in angular.json file-> inside "styles" array add "node_modules/bootstrap/dist/css/bootstrap.min.css" and inside script array add "node_modules/bootstrap/dist/js/bootstrap.min.js"

  • Related