Ionic 为什么“npm install”告诉我“未安装任何项您必须自己安装对等依赖项:“?

icomxhvb  于 2022-12-31  发布在  Ionic
关注(0)|答案(2)|浏览(202)

我在试一个React/还原/离子应用程序。
当我运行npm install时,我得到错误:

>`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.

但是,当我查看package.json时,它看起来确实应该安装react-routerreact-router-dom

"@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",

你知道这是怎么回事吗?

f3temu5u

f3temu5u1#

查看警告消息提供的版本,您需要卸载较新的版本,然后重新安装专门提供的版本卸载:

npm uninstall react-router react-router-dom

(as进行健全性检查,查看package.json以确认已删除),然后安装警告中提供的特定所需版本

npm i -S react-router@^4.3.1 react-router-dom@^4.3.1
l0oc07j2

l0oc07j22#

您可以尝试清除该高速缓存并重新安装:
第一个月
npm install

相关问题