Home > Net >  I am getting this error when i try to add bootstrap in my Angular project
I am getting this error when i try to add bootstrap in my Angular project

Time:07-12

enter image description here

I tried using following command too,

ng add @ng-bootstrap/ng-bootstrap -- force

It didnt worked, so i deleted both node_modules and package-lock.json files. I reinstalled it using following command.

npm install --legacy-peer-deps

Still i am having the same problem. Anyone have an idea?

CodePudding user response:

You simpley do 

npm install bootstrap

and then map the respected soure location into your angular.json file 

"scripts": [ 
    "./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
],
"styles": [
    "styles.css","./node_modules/bootstrap/dist/css/bootstrap.min.css"
]

And restart your app 
or
You can try with ngx also

CodePudding user response:

I was following a tutorial, thats why i had to use those commands. insted i used this.

  • I had to just install bootstrap on your angular 14 and import css file to style.css file. this is only for css importing. so you can run command bellow:

npm install bootstrap --save

  • then i imported bootstrap css on style.css file as like bellow:

@import "~bootstrap/dist/css/bootstrap.css";

Referance link

  • Related