I tried to install Bootstrap in my Angular application by using the CLI command: ng add @ng-bootstrap/ng-bootstrap. But I got the following errors in return. How to resolve these dependency conflict while installing Bootstrap using Angular CLI command? enter image description here
Your problem is due to an upstream peer dependency version conflict where @ng-bootstrap/ng-bootstrap@12.1.2 (upstream) has a peer dependency of @angular/common@^13.0.0 (downstream). Please research Peer Dependencies
Also check @ng-bootstrap/ng-bootstrap dependencies
You have a number of options:
Install using --legacy-peer-deps
switch to "...accept a potentially broken dependency resolution." (as per the error message). This will mean that the package developer of @ng-bootstrap/ng-bootstrap@12.1.2
will/should have tested this with @angular/common@^13.0.0
.
npm install @ng-bootstrap/ng-bootstrap --legacy-peer-deps
Either install Angular v13 globally npm install -g @angular/cli@13.n.n
and create new project ng new project
or if you have already created a project you could adjust the versions in package.json
accordingly and npm install
or use npx
Also check this Fix the upstream dependency conflict while installing ng-bootstrap/ng-bootstrap