npm WARN bootstrap@4.2.1 requires a peer of jquery@1.9.1 - 3 but none is installed

Viewed 72716

I tried to install bootstrap in my Angular Project by

npm install --g bootstrap

but i am getting following warning

npm WARN bootstrap@4.2.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.

npm WARN bootstrap@4.2.1 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 Answers

Just do as it says:

npm i jquery@1.9.1 --save

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

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.

This worked for me -

npm i -g npm@3.10.10

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';

I resolved the above issue by running the npm command

npm install --save bootstrap

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.

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 jquery@1.9.1 --save

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

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.

Related