Olga Pshenichnikova
Olga Pshenichnikova

Reputation: 1581

NPM WARN: [email protected] requires a peer of popper.js

I have follow dependency part in package.json:

"dependencies": {
    "bootstrap": "*",
    "bootstrap-datepicker": "^1.7.1",
    "bower": "^1.8.2",
    "chosen-js": "^1.8.2",
    "datatables.net-dt": "^1.10.16",
    "jQuery-QueryBuilder": "^2.4.5",
    "jquery": "^1.4",
    "jquery-tagit": "*",
    "jquery-ui-dist": "^1.12.1",
    "prismjs": "^1.8.1",
    "qtip2": "^3.0.3",
    "multi-step-modal": 
        "git+ssh://[email protected]:2022/dependencies/multi-step-modal.git"
}

When I run npm update, I get:

[email protected] /home/opshenichnikova/NetBeansProjects/lps/public
├── [email protected] 
├── [email protected] 
├── [email protected]  (git+ssh://[email protected]:2022/dependencies/multi-step-modal.git#2f9bc29093c9939c2ba23fa18fd22001a74040d2)
├── UNMET PEER DEPENDENCY popper.js@^1.12.9
└── [email protected] 

npm WARN [email protected] requires a peer of popper.js@^1.12.9 but none was installed.

I searched for the reason and found just this: Bootstrap 4: Uncaught ReferenceError: Popper is not defined

I know that it is just warning, but I always keep my code warning-free.

Upvotes: 25

Views: 56625

Answers (5)

EnthuCoder
EnthuCoder

Reputation: 107

I got this issue for Bootstrap with Angular, while I was installing Bootstrap not in the directory where the Angular project was created. It worked successfully in my case every time I installed it in the angular directory/folder look at when installed in the project folder.

install bootstrap in project folder

Upvotes: 0

Sandun Susantha
Sandun Susantha

Reputation: 1140

If it is saying as follows image in, then

enter image description here

It is asking for install popper.js for your project. So get the cmd on your project location and run the following command.

npm install popper.js --save

Then you can see as in following image.

enter image description here

Upvotes: 5

Hemang
Hemang

Reputation: 27072

Have to add "popper.js":"^require_version" into package.json under the dependencies.

Upvotes: 1

Carol Skelly
Carol Skelly

Reputation: 362880

Bootstrap 4.0.0 requires popper, so just add "popper.js": "^1.12.9" to the package.json

For example dropdown, tooltips and popovers won't work: enter image description here

https://www.codeply.com/go/CuOfa7UnUA (broken w/o popper)

Note: As of 4.1, popper.js is only required for dropdowns, tooltips and popovers.

Upvotes: 12

Enmanuel
Enmanuel

Reputation: 443

Popper.js is not really necessary

Bootstrap 4.0.0 release contains 2 new files bootstrap.bundle.js and bootstrap.bundle.min.js which contain Popper.js inside and you really do not need it.

bootstrap.bundle.min.js is exactly Bootstrap.js + Popper.js.

In Bootstrap v4.0.0 documentation it is still mentioned that you need the file for some components

Components requiring JavaScript

  • Dropdowns for displaying and positioning (also requires Popper.js)
  • Tooltips and popovers for displaying and positioning (also requires Popper.js)

I have not tested it but I think it is not necessary

Solutions

You can use the NPM path 'bootstrap/dist/js/bootstrap.bundle.js'.

Or if you finally want to download Popper.js, download the version you need.

bootstrap/package.json

Upvotes: 29

Related Questions