0

I'm trying to get a react/redux/ionic app working.

When I run npm install I get errors:

>`enter code here`npm install
npm WARN @ionic/react@0.0.5 requires a peer of react-router@^4.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN @ionic/react@0.0.5 requires a peer of react-router-dom@^4.3.1 but none is installed. You must install peer dependencies yourself.

But when I look in package.json it certainly looks as if react-router and react-router-dom should be installed:

"@ionic/react": "0.0.5",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-redux": "^7.0.3",
"react-router": "^5.0.0",
"react-router-dom": "^5.0.0",
"react-scripts": "3.0.1",
"redux": "^4.0.1",

Any ideas as to what might be going on?

Jeff Dege
  • 11,190
  • 22
  • 96
  • 165
  • you need to resolve peer dependency conflicts, https://stackoverflow.com/questions/46053414/npm-warn-requires-a-peer-of-but-none-is-installed-you-must-install-peer/49188160 – Federkun Aug 12 '19 at 22:24
  • Check out this answer. https://stackoverflow.com/a/49188160/2992745 – André Tzermias Aug 12 '19 at 22:27
  • Delete your node_modules folder and your package-lock.json file and rerun npm install – Jake Aug 12 '19 at 22:34

2 Answers2

1

Look at the version supplied by the warning message you need to uninstall the newer versions and re-install the specifically supplied versions uninstall:

npm uninstall react-router react-router-dom

(as a sanity check, look at package.json to confirm removed) then install specifically needed versions as supplied in warning

npm i -S react-router@^4.3.1 react-router-dom@^4.3.1
Jason Ashley
  • 631
  • 6
  • 8
  • The message says @ionic/react needs react-router^4.3.1, and the version installed is greater than that. – Jeff Dege Aug 12 '19 at 22:33
  • 1
    right, so the version needs to start with v4 and the installed version being higher, most likely has modifications that break functionality of what is expected of a v4 intall – Jason Ashley Aug 12 '19 at 22:35
0

You can try cleaning the cache and reinstalling:

npm cache clean -f

npm install

knoxgon
  • 1,070
  • 2
  • 15
  • 31
Luiz Correia
  • 134
  • 4