33
votes

I tried to install bootstrap in my Angular Project by

npm install --g bootstrap

but i am getting following warning

npm WARN [email protected] requires a peer of [email protected] - 3 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of popper.js@^1.14.6 but none is installed. You must install peer dependencies yourself.

I am using following version of ng and npm

Angular CLI: 7.1.4
Node: 10.15.0
OS: win32 x64
Angular: 7.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.11.4
@angular-devkit/build-angular     0.11.4
@angular-devkit/build-optimizer   0.11.4
@angular-devkit/build-webpack     0.11.4
@angular-devkit/core              7.1.4
@angular-devkit/schematics        7.1.4
@ngtools/webpack                  7.1.4
@schematics/angular               7.1.4
@schematics/update                0.11.4
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.23.1
9
Just do as it says npm i [email protected] --save. I see that you want to install bootstrap globally on your system. Maybe you would like to reconsider and install it per project. To me it make sense because it is part of your project.Samir Sadek

9 Answers

44
votes

Just do as it says:

npm i [email protected] --save

the option --save is to save this dependency to your project.

6
votes

I had the same problem and this is the solution:

npm install bootstrap jquery popper.js --save

The system automatically resolves the references for you.

3
votes

This worked for me -

npm i -g [email protected]
1
votes

I resolved the above issue by running the npm command

npm install --save bootstrap

1
votes

npm installation:

$npm install bootstrap

$npm install bootstrap jquery popper.js --save

then

import to the react folder(index.js):

import 'bootstrap';

import 'bootstrap/dist/css/bootstrap.min.css';

1
votes

If you are using Angular, you don't need those dependencies of jquery etc. Angular is responsible for rendering and manipulating the DOM and if you’re interfering with it using jQuery, you might get some unwanted results.

0
votes

In your package.json file search for "dependencies" and editing it to show as

  "dependencies": {
     //same lib
    "jquery": "^1.9.1",
  },

or run this command from cmd

npm i [email protected] --save

0
votes

you are installing bootstrap globally .you need to first open your project file after that go to cmd and install the bootstrap and jquery because the compiler didn't understand that where we have to install. the code is for installing bootstrap and jquery is PS E:\web\Angular\Angular program\my-first-project> npm install bootstrap@3 jquery --save then it will download and check-in your package.json file its display the version of your software

-1
votes

I have resolved jQuery dependency with following steps in my react development project

npm install react-bootstrap bootstrap --save
npm audit fix --force

Result: found 0 vulnerabilities

It also fixes the issue, if another dependency is having issues.