arsha
arsha

Reputation: 27

Unable to add ng-bootstrap in angular using ng command

I am new in angular using 12.1.4 version. I am unable to add or install bootstrap dependency in angular. When I run below command in cmd prompt.

ng add @ng-bootstrap/ng-bootstrap

Then it throw an error as shown in below image:

Angular Error

Upvotes: 0

Views: 568

Answers (1)

Salahuddin Ahmed
Salahuddin Ahmed

Reputation: 5650

Install bootstrap in your angular 12 app like below. This is only for css importing.

npm install bootstrap --save

Now you need to import bootstrap css directly in style.css file like this:

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

However, if you are required to install bootstrap with jquery and popper js then run the following commands like below:

npm install bootstrap --save
npm install jquery --save
npm install popper.js --save

After successfully run the above commands import it in angular.json file like this:

 "styles": [
    "node_modules/bootstrap/dist/css/bootstrap.min.css",
    "src/styles.css"
  ],
  "scripts": [
      "node_modules/jquery/dist/jquery.min.js",
      "node_modules/popper.js/dist/umd/popper.min.js",
      "node_modules/bootstrap/dist/js/bootstrap.min.js"
  ]

Upvotes: 1

Related Questions