0

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

karel
  • 5,489
  • 46
  • 45
  • 50
arsha
  • 17
  • 1
  • 6
  • Check this link "https://stackoverflow.com/questions/37649164/how-to-add-bootstrap-to-an-angular-cli-project" or "https://loiane.com/2017/08/how-to-add-bootstrap-to-an-angular-cli-project/" – Ravi Ashara Sep 09 '21 at 06:19

1 Answers1

1

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"
  ]
Salahuddin Ahmed
  • 4,854
  • 4
  • 14
  • 35