2

Update 1

I created a new project for test purposes using command ng new project1. Then added bootstrap package like this ng add @ng-bootstrap/ng-bootstrap. Even then same problem is occurring. Why?

About

I am using Angular CLI 13.1.3. while trying to install ng bootstrap I faced following error details.

Then I tried to update the angular/compiler dependency from 13.1.3 to 13.1.0 using the following commands.

ng uninstall angular/compiler
ng remove angular/compiler

but both of them are not available in command list

Would you like to suggest something?

Error messages

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/compiler
npm ERR! @angular/compiler@"~13.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"13.3.1" from @angular/[email protected]
npm ERR! node_modules/@angular/localize
npm ERR! peer @angular/localize@"^13.0.0" from @ng-bootstrap/[email protected]
npm ERR! node_modules/@ng-bootstrap/ng-bootstrap
npm ERR! @ng-bootstrap/ng-bootstrap@"12.0.1" from the root project

5
  • Yikes.. don’t try to manually just update internal angular dependencies.. that might break a lot. Commented Apr 4, 2022 at 17:18
  • I created a new project for test purposes using command ng new project1. Then added bootstrap package like this ng add @ng-bootstrap/ng-bootstrap. Even then same problem is occurring. Why? Commented Apr 4, 2022 at 18:20
  • I suspect you have the incorrect version of ng-bootstrap. Maybe the schematic is not yet up-to-date? Commented Apr 4, 2022 at 19:28
  • I did not mention specific version of bootstrap. @angular/cli version is 13.1.3, what should be the correct version for bootstrap? Commented Apr 4, 2022 at 19:40
  • Try to create a new project in angular cli and then add ng bootstrap. you will notice that it does not allow to do so. Commented Apr 4, 2022 at 20:56

1 Answer 1

2
+50

Following commands should work for creating a new Angular project with ng-bootstrap

npm i -g @angular/cli
ng new project1
cd project1
ng add @ng-bootstrap/ng-bootstrap

This will ensure you have the latest Angular CLI version before creating the project.

When you need to upgrade Angular dependencies, you can run ng update. This will tell you any further commands you need to run to upgrade your Angular dependencies.

At this point, your package.json file should be in a good state, and anyone else can install your project using npm i.

Sign up to request clarification or add additional context in comments.

1 Comment

stackoverflow.com/questions/71890666/… would you like to answer here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.