简体   繁体   中英

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

在此处输入图像描述

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM