5

While installing Bootstrap 4 (the latest beta version) with NPM : `npm install bootstrap@4.0.0-beta, I got this message :

+-- bootstrap@4.0.0-beta
+-- font-awesome@4.7.0
+-- UNMET PEER DEPENDENCY jquery@>=3.0.0
`-- UNMET PEER DEPENDENCY popper.js@^1.11.0

npm WARN bootstrap@4.0.0-beta requires a peer of jquery@>=3.0.0 but none was installed.
npm WARN bootstrap@4.0.0-beta requires a peer of popper.js@^1.11.0 but none was installed.
npm WARN b4starter@1.0.0 No repository field.

To remove this warning : npm i --save jquery popper.js

But, why the first command didn't install Bootstrap 4, Jquery and Popper.js in one time? normally NPM should install dependencies !!

Any explaination please?

Thank you

MDIT
  • 1,508
  • 5
  • 25
  • 38

2 Answers2

7

The problem was reported to the Bootstrap development team in this issue. In principle, Bootstrap 4 can be used without jQuery and Popper, but these two optional packages are considered as peer dependencies in the bootstrap@4.0.0-beta version installed with npm.

According to the comments made by the Bootstrap developers in the discussion, they are going to offer two different Bootstrap packages:

  • bootstrap-css: which will not have any dependency on jQuery and Popper
  • bootstrap: which, I assume, will install the required dependencies
ConnorsFan
  • 70,558
  • 13
  • 122
  • 146
2

All depend of the configuration of the package.json from the npm package. if you check the respository for bootstrap here, you can see this:

...
"dependencies": {},
"peerDependencies": {
 "jquery": "^3.0.0",
 "popper.js": "^1.12.3"
},
...

When you install a npm package, just the dependencies specified in package.json file as dependencies would be download with the package.

If you want to know more about peerDependecies this is the link: https://docs.npmjs.com/files/package.json#peerdependencies

Julio Guerra
  • 390
  • 3
  • 14