谷歌地图反应安装失败

时间:2021-06-20 07:59:10

标签: reactjs npm

我想在我的应用程序中使用谷歌地图。但我未能使用 npm install --save google-map-react 安装它。

它在终端中显示以下错误。

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: react-auth@0.1.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"~0.14.8 || ^15.0.0 || ^16.0.0" from google-maps-react@2.0.6
npm ERR! node_modules/google-maps-react
npm ERR!   google-maps-react@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\user\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2021-06-20T07_57_58_515Z-debug.log

2 个答案:

答案 0 :(得分:0)

看来是最新版 npm 的 Peer Dependencies 有问题。 尝试:npm install --legacy-peer-deps --save google-map-react

试试:npm install --force --save google-map-react

我希望它有效。如需更多信息,请have a read

答案 1 :(得分:0)

尝试-

npm install --force --save google-map-react

代替

npm install --save google-maps-react