2

When we run yarn in a project with no node_modules directory, we get the following warning message during the dependency installs:

warning " > bootstrap@4.4.1" has unmet peer dependency "jquery@1.9.1 - 3".
warning " > bootstrap@4.4.1" has unmet peer dependency "popper.js@^1.16.0".

However, it appears that bootstrap and react-bootstrap works fine without doing anything to fix these 2 warnings. package.json also do not contain entries for these 2 packages.

Question: Why does Bootstrap and related files appear to continue working despite having unmet peer dependencies?

Isn't the whole point of yarn and npm be to manage these dependencies?

What is the proper way to resolve these warnings?


Part of packages.json

{
  ...

  "dependencies": {
    "bootstrap": "^4.4.1",
    "react-bootstrap": "^1.0.0",

    ...
  }
}
RobC
  • 22,977
  • 20
  • 73
  • 80
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830

1 Answers1

4

jquery and popper.js are used by Bootstrap for their Javascript components (dropdown, modal etc). However: If you only use the CSS part - you do not need these. That is probably why they are listed as "peer-dependencies".

There is a Pull Request to mute theses warnings. They are just warnings afterall.

react-bootstrap does not need/replaces jquery but it uses popper in another Version (@popperjs/core) for tooltip placement. That is why everything is working - even though Bootstrap is missing some "peer-dependencies". Libraries like (react|vue|ng)-bootstrap usually only use the CSS part of Bootstrap and rewrite the Javascript part entirely.

What is the proper way to resolve these warnings?

To my understanding: You will have to add them as dependencies in your project - even though you do not actually need them. Or... Ignore the warnings.

madflow
  • 7,718
  • 3
  • 39
  • 54