24

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://git@git.ias.su:2022/dependencies/multi-step-modal.git"
}

When I run npm update, I get:

LPS@1.0.0 /home/opshenichnikova/NetBeansProjects/lps/public
├── bootstrap@4.0.0 
├── jQuery-QueryBuilder@2.5.0 
├── multi-step-modal@1.0.0  (git+ssh://git@git.ias.su:2022/dependencies/multi-step-modal.git#2f9bc29093c9939c2ba23fa18fd22001a74040d2)
├── UNMET PEER DEPENDENCY popper.js@^1.12.9
└── prismjs@1.12.2 

npm WARN bootstrap@4.0.0 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.

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
Olga Pshenichnikova
  • 1,509
  • 4
  • 22
  • 47

5 Answers5

29

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

Enmanuel
  • 443
  • 4
  • 7
12

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.

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
5

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

Sandun Susantha
  • 1,010
  • 1
  • 10
  • 11
1

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

Hemang
  • 26,840
  • 19
  • 119
  • 186
0

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

EnthuCoder
  • 67
  • 8