Source:  Twitter logo

It looks like i have some problem with react-router-dom package if i try to install it i have this warning (see the screenshot):

npm WARN react-router-dom@4.0.0 requires a peer of react@^15 but none is installed.
You must install peer dependencies yourself.
npm WARN react-router@4.2.0 requires a peer of react@>=15 but none is installed.
You must install peer dependencies yourself.

I also tried to update all the packages but with bad results.

Any suggestion?

Follow the below steps.

  1. Delete your node_modules.
  2. Remove react, react-router and react-router-dom dependencies from package.json file.
  3. and then try npm install react react-router react-router-dom --save.

hope so this will resolve your issue.

5 users liked answer #0dislike answer #05
Javed Shaikh profile pic
Javed Shaikh

You have react-router-dom of v 4.0.0, and a react of v 0.14.3. It's time to upgrade your react. The error has made it clear that react-router-dom requires react of > 15 but you are at 0.14.3.

Step 1:

delete the react, react-dom, react-redux, and redux from node_modules

Step2:

update your package.json with latest versions of these packages: react, react-dom, react-redux, redux. As of now, their versions are:

"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",

step3:

npm install

This should fix the problem permanently.

1 users liked answer #1dislike answer #11
jamesdeath123 profile pic
jamesdeath123

Have you installed react? Can you first try to execute below command and then install react-router-dom: npm install react --save

0 users liked answer #2dislike answer #20
kalpana pagariya profile pic
kalpana pagariya

Copyright © 2022 QueryThreads

All content on Query Threads is licensed under the Creative Commons Attribution-ShareAlike 3.0 license (CC BY-SA 3.0).