'Google map react failed to installed
I want to use google map in my app.But I have failed to install it using npm install --save google-map-react.
It shows the following error in the terminal.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
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 [email protected]
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
Solution 1:[1]
Looks like it's a problem with Peer Dependencies in the latest version of npm.
Try: npm install --legacy-peer-deps --save google-map-react
OR
Try: npm install --force --save google-map-react
I hope it works. For more info, have a read.
Solution 2:[2]
Try -
npm install --force --save google-map-react
Instead of
npm install --save google-maps-react
Solution 3:[3]
The application I'm building with create-react-app 17.0.2 wasn't able to install the dependency with npm install --save google-maps-react. However, npm install --legacy-peer-deps --save google-maps-react worked and I did not have to attempt to force the dependency.
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rukshan |
| Solution 2 | Mayura Pavan |
| Solution 3 | 2pichar |
