简体   繁体   中英

Why does “npm install” tell me “none is installed You must install peer dependencies yourself:”?

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?

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

Just try:

npm cache clean -f npm install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM