Home > Back-end >  Could not resolve dependency: google-maps-react
Could not resolve dependency: google-maps-react

Time:02-11

It is my first time to clone react project from github

i did:

$ git clone <link>

after that:

npm install

but i faced an error with google-maps-react

$ npm install --save google-maps-react
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @iso/[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@"^2.0.6" 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.

i tried:

$ npm cache clean --force
$ npm install -g npm

,:

$npm config set legacy-peer-deps true

,:

npm install  --force

,:

npm install --save --legacy-peer-deps

,:

rm -rf node_modules

and more ..

node js version:

16.13.2

react version:

17.0.2

npm version:

8.4.1

nothing seem to work

am i missing something?

CodePudding user response:

The project has a peer dependency on React 15 or 16 and you are using 17.0.2 - The npm error states the reason

Downgrade your react version if you want to use this library as is or change the package.json for the lib, test and confirm to the author that they are good on 17.0.2 raising a PR

"peerDependencies": {
    "react": "~0.14.8 || ^15.0.0 || ^16.0.0",
    "react-dom": "~0.14.8 || ^15.0.0 || ^16.0.0"
  },

Here's npm telling you reason in the log

npm ERR! Fix the upstream dependency conflict, or retry

CodePudding user response:

Solution:

The app is using "yarn" I'm able now to run the app after installing "yarn add node-sass"

  • Related