Home > Enterprise >  I do I resolve the package.jason file error?
I do I resolve the package.jason file error?

Time:06-30

Why am I having the below error

PS C:\Users\USER\Desktop\Shareme\shareme_frontend> npm install @sanity/client @sanity/image-url react-google-login react-icons react-loader-spinner react-masonry-css react-router-dom uuid
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
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@"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16 || ^17" from [email protected]
npm ERR! node_modules/react-google-login
npm ERR!   react-google-login@"*" 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\2022-06-29T15_11_18_949Z-debug-0.log

CodePudding user response:

react-google-login is not updated to the latest react v18. Either wait for an update, downgrade react to v17, or use --force flag.

npm i react-google-login --force

Note that by using --force, there is no guarantee that this package will work with v18 of react

CodePudding user response:

[email protected] is not compatible with react 18 version as 5.2.2 is published year ago as per npm page.

It is still looking for react version of 17 / 16. Below error block will tell you this:

npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16 || ^17" from [email protected]

You can downgrade your react for this specific project via :

  1. deleting node_modules

  2. run npm cache clean

  3. manually update your package.json to change version of react to 17

  4. run npm install

  • Related