3

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: 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
Rukshan Jayasekara
  • 1,945
  • 1
  • 6
  • 26
Somen
  • 41
  • 1
  • 4

3 Answers3

5

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.

Rukshan Jayasekara
  • 1,945
  • 1
  • 6
  • 26
5

Try -

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

Instead of

npm install --save google-maps-react
Mayura Pavan
  • 111
  • 1
  • 1
1

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.

.

2pichar
  • 1,348
  • 4
  • 17