'Getting Dependency Error during installation of google-map-react

When i try to install install google maps packeage , i get this error every time.

npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^18.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/google-map-react
npm ERR!   google-map-react@"*" from the root project```


Solution 1:[1]

google-map-react depends on react 16 or 17 but it seems like you are using version 18 which is why you getting that error.

You can check package.json of google-map-react

"peerDependencies": {
    "react": "^16.0.0 || ^17.0.0",
    "react-dom": "^16.0.0 || ^17.0.0"
  },

You can use react-google-charts package for the same purpose which is support the latest React version

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 SKG