tomchentw / react-google-maps

React.js Google Maps integration component
https://tomchentw.github.io/react-google-maps/
MIT License
4.63k stars 935 forks source link

Could not resolve dependency: react@"^15.0.0 || ^16.0.0" from react-google-maps@9.4.5 #1071

Open porot07 opened 3 years ago

porot07 commented 3 years ago

Hello, I tried install react-google-maps on my project and I got error:

# npm resolution error report

2021-04-15T09:36:08.537Z

While resolving: test_project@0.0.2
Found: react@17.0.2
node_modules/react
  react@"^17.0.2" from the root project

Could not resolve dependency:
peer react@"^15.0.0 || ^16.0.0" from react-google-maps@9.4.5
node_modules/react-google-maps
  react-google-maps@"*" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
  "current": {
    "name": "react",
    "version": "17.0.2",
    "location": "node_modules/react",
    "dependents": [
      {
        "type": "prod",
        "name": "react",
        "spec": "^17.0.2",
      }
    ]
  },
  "currentEdge": {
    "type": "prod",
    "name": "react",
    "spec": "^17.0.2",
  },
  "edge": {
    "type": "peer",
    "name": "react",
    "spec": "^15.0.0 || ^16.0.0",
    "error": "INVALID",
    "from": {
      "name": "react-google-maps",
      "version": "9.4.5",
      "location": "node_modules/react-google-maps",
      "dependents": [
        {
          "type": "prod",
          "name": "react-google-maps",
          "spec": "*",
        }
      ]
    }
  },
  "peerConflict": null,
  "strictPeerDeps": false,
  "force": false
}
eddOrnelas commented 3 years ago

Same problem, any update here?

JustFly1984 commented 3 years ago

@porot07 @eddOrnelas The repo of this project is unmaintained more than 3 years, and we had build new version https://www.npmjs.com/package/@react-google-maps/api

Supporting react 17 since version 2

We had rewrite it to TypeScript, and updating it frequently: https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api You can enjoy autocomplete.

You can see our docs: https://react-google-maps-api-docs.netlify.app

Also a lot of examples: https://react-google-maps-api-gatsby-demo.netlify.app/ https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api-gatsby-example/src/examples

The bundle size is much smaller: https://bundlephobia.com/result?p=@react-google-maps/api 
Our Slack channel: https://join.slack.com/t/react-google-maps-api/shared_invite/enQtODc5ODU1NTY5MzQ4LTBiNTYzZmY1YmVjYzJhZThkMGU0YzUwZjJkNGJmYjk4YjQyYjZhMDk2YThlZGEzNDc0M2RhNjBmMWE4ZTJiMjQ

Enjoy!

eddOrnelas commented 3 years ago

@JustFly1984 yes i just found out and used the new version, sorry for asking updates before researching XD a disclaimer/note can be useful in this case :P

DarkAng3L commented 3 years ago

Well since it is not maintained for more than 3+ years, it should be mentioned somewhere in https://www.npmjs.com/package/react-google-maps or https://github.com/tomchentw/react-google-maps docs that it is recommended to switch to https://www.npmjs.com/package/@react-google-maps/api :-?

JustFly1984 commented 3 years ago

@DarkAng3L Nobody has access to the repo. Possibly an author died or not interested in open source anymore, so there is no option to do what you want. In general it is a good practice to look how your dependencies maintained before using it in your project. There is almost always a better alternative. I've posted to almost every issue for last 3 years.

mattvb91 commented 3 years ago

@JustFly1984 thank you for forking, appreciated!

kristinabressler commented 1 year ago

I have a React project that I build about 4 years ago. Now I'm trying to update my react project. However, I did encounter this error that's mentioned above. So how do I fix this error?

I tried npm uninstall react-google-maps but all I got was this:

➜  weather-app git:(master) ✗ npm uninstall react-google-maps
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-google-maps@7.3.0
npm WARN Found: react@16.12.0
npm WARN node_modules/react
npm WARN   peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from mini-create-react-context@0.3.2
npm WARN   node_modules/mini-create-react-context
npm WARN     mini-create-react-context@"^0.3.0" from react-router@5.1.2
npm WARN     node_modules/react-router
npm WARN   10 more (react-dom, react-native-open-maps, react-router, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"15.5.4" from react-google-maps@7.3.0
npm WARN node_modules/react-google-maps
npm WARN
npm WARN Conflicting peer dependency: react@15.5.4
npm WARN node_modules/react
npm WARN   peer react@"15.5.4" from react-google-maps@7.3.0
npm WARN   node_modules/react-google-maps
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-google-maps@7.3.0
npm WARN Found: react-dom@16.12.0
npm WARN node_modules/react-dom
npm WARN   react-dom@"^16.12.0" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"15.5.4" from react-google-maps@7.3.0
npm WARN node_modules/react-google-maps
npm WARN
npm WARN Conflicting peer dependency: react-dom@15.5.4
npm WARN node_modules/react-dom
npm WARN   peer react-dom@"15.5.4" from react-google-maps@7.3.0
npm WARN   node_modules/react-google-maps
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-native@0.72.5
npm ERR! Found: react@16.12.0
npm ERR! node_modules/react
npm ERR!   peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from mini-create-react-context@0.3.2
npm ERR!   node_modules/mini-create-react-context
npm ERR!     mini-create-react-context@"^0.3.0" from react-router@5.1.2
npm ERR!     node_modules/react-router
npm ERR!       react-router@"5.1.2" from react-router-dom@5.1.2
npm ERR!       node_modules/react-router-dom
npm ERR!         react-router-dom@"^5.1.2" from the root project
npm ERR!   peer react@"^16.0.0" from react-dom@16.12.0
npm ERR!   node_modules/react-dom
npm ERR!     react-dom@"^16.12.0" from the root project
npm ERR!   9 more (react-native-open-maps, react-router, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"18.2.0" from react-native@0.72.5
npm ERR! node_modules/react-native
npm ERR!   peer react-native@">0.45.0" from react-native-open-maps@0.3.4
npm ERR!   node_modules/react-native-open-maps
npm ERR!     react-native-open-maps@"^0.3.4" from the root project
npm ERR!   peer react-native@"*" from @react-native/virtualized-lists@0.72.8
npm ERR!   node_modules/react-native/node_modules/@react-native/virtualized-lists
npm ERR!     @react-native/virtualized-lists@"^0.72.8" from react-native@0.72.5
npm ERR!
npm ERR! Conflicting peer dependency: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@"18.2.0" from react-native@0.72.5
npm ERR!   node_modules/react-native
npm ERR!     peer react-native@">0.45.0" from react-native-open-maps@0.3.4
npm ERR!     node_modules/react-native-open-maps
npm ERR!       react-native-open-maps@"^0.3.4" from the root project
npm ERR!     peer react-native@"*" from @react-native/virtualized-lists@0.72.8
npm ERR!     node_modules/react-native/node_modules/@react-native/virtualized-lists
npm ERR!       @react-native/virtualized-lists@"^0.72.8" from react-native@0.72.5
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.

What steps do I need to take to resolve those errors and update all the old packages?

ayoubkhan558 commented 5 months ago

any update?