react-use icon indicating copy to clipboard operation
react-use copied to clipboard

Error resolving dependencies on `npm install` (React 18)

Open hb-webdev opened this issue 3 years ago • 0 comments

I installed the newest version of react-use on React Native 0.70.4 (MacOS) but it throws this error:

user@MacBook-Pro myApp % npm install react-use
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.1.0" from the root project
npm ERR!   peer react@"^16.8.0  || ^17.0.0 || ^18.0.0" from [email protected]
npm ERR!   node_modules/react-use
npm ERR!     react-use@"*" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.2.0" from [email protected]
npm ERR! node_modules/react-dom
npm ERR!   peer react-dom@"^16.8.0  || ^17.0.0 || ^18.0.0" from [email protected]
npm ERR!   node_modules/react-use
npm ERR!     react-use@"*" 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 /Users/user/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2022-10-28T14_22_43_282Z-debug-0.log
user@MacBook-Pro myApp %

I don't know why because I thought react@18.*.* support was added:

  • https://github.com/streamich/react-use/issues/2329
  • https://github.com/streamich/react-use/issues/2325
  • https://github.com/streamich/react-use/issues/2311

More info:

  • My app's package.json shows "react": "18.1.0"

  • npm react -v shows 8.19.2 (no idea where that's coming from)

user@MacBook-Pro myApp % npm react -v
8.19.2
user@MacBook-Pro myApp % npm upgrade react             

up to date, audited 1398 packages in 1s

109 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
user@MacBook-Pro myApp % 

Can you please resolve?

hb-webdev avatar Oct 28 '22 14:10 hb-webdev