9

Hi I have this problem where if I want to install react-spring into my react project It just pops up bunch of dependencies errors and warnings and I don't know what to do with it. I tried to check documentation of react-spring but I couldn't find anything. I checked few pages here on stackoverflow and I still did not find anything useful. Can somebody help?

npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/react-spring/node_modules/react
npm WARN   peer react@">=16.8" from @react-spring/[email protected]
npm WARN   node_modules/react-spring/node_modules/@react-spring/konva
npm WARN     @react-spring/konva@"^9.0.0" from [email protected]
npm WARN     node_modules/react-spring
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"16.8.x" from [email protected]
npm WARN node_modules/react-spring/node_modules/react-konva
npm WARN   peer react-konva@">=16.8" from @react-spring/[email protected]
npm WARN   node_modules/react-spring/node_modules/@react-spring/konva
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/react-spring/node_modules/react
npm WARN   peer react@">=16.8" from @react-spring/[email protected]
npm WARN   node_modules/react-spring/node_modules/@react-spring/konva
npm WARN     @react-spring/konva@"^9.0.0" from [email protected]
npm WARN     node_modules/react-spring
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.0.0" from [email protected]
npm WARN node_modules/react-spring/node_modules/react-dom
npm WARN   peer react-dom@"16.8.x" from [email protected]
npm WARN   node_modules/react-spring/node_modules/react-konva
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/konva
npm WARN   peer konva@">=2.6" from @react-spring/[email protected]
npm WARN   node_modules/react-spring/node_modules/@react-spring/konva
npm WARN     @react-spring/konva@"^9.0.0" from [email protected]
npm WARN     node_modules/react-spring
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer konva@"^3.2.3" from [email protected]
npm WARN node_modules/react-spring/node_modules/react-konva
npm WARN   peer react-konva@">=16.8" from @react-spring/[email protected]
npm WARN   node_modules/react-spring/node_modules/@react-spring/konva
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react-dom
npm WARN   peerOptional react-dom@">=17.0" from @react-three/[email protected]
npm WARN   node_modules/@react-three/fiber
npm WARN     peer @react-three/fiber@">=6.0" from @react-spring/[email protected]
npm WARN     node_modules/@react-spring/three
npm WARN
npm WARN Could not resolve dependency:
npm WARN peerOptional react-dom@">=17.0" from @react-three/[email protected]
npm WARN node_modules/@react-three/fiber
npm WARN   peer @react-three/fiber@">=6.0" from @react-spring/[email protected]
npm WARN   node_modules/@react-spring/three
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"*" from @testing-library/[email protected]
npm ERR!   node_modules/@testing-library/react
npm ERR!     @testing-library/react@"^11.2.5" from the root project
npm ERR!   peer react@"17.0.1" from [email protected]
npm ERR!   node_modules/react-dom
npm ERR!     peer react-dom@"*" from @testing-library/[email protected]
npm ERR!     node_modules/@testing-library/react
npm ERR!       @testing-library/react@"^11.2.5" from the root project
npm ERR!     peer react-dom@">=16.0.0" from [email protected]
npm ERR!     node_modules/react-visibility-sensor
npm ERR!       react-visibility-sensor@"^5.1.1" from the root project
npm ERR!     1 more (the root project)
npm ERR!   4 more (react-scripts, react-visibility-sensor, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.2" from [email protected]
npm ERR! node_modules/@react-three/fiber/node_modules/react-reconciler
npm ERR!   react-reconciler@"^0.26.2" from @react-three/[email protected]
npm ERR!   node_modules/@react-three/fiber
npm ERR!     peer @react-three/fiber@">=6.0" from @react-spring/[email protected]
npm ERR!     node_modules/@react-spring/three
npm ERR!       @react-spring/three@"^9.0.0" from [email protected]
npm ERR!       node_modules/react-spring
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:\...\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
5
  • did u try global install? npm install -g react-spring or try npm install react-spring --save Commented Apr 1, 2021 at 0:09
  • what version of react and react-dom are you using? Commented Apr 1, 2021 at 4:23
  • @arminyahya "react": "^17.0.1", "react-dom": "^17.0.1", Commented Apr 1, 2021 at 8:57
  • @ksa I tried both on global it wont compile on --save it wont install and have same problem Commented Apr 1, 2021 at 8:58
  • looks like react spring dependencies needs react and react-dom 17.0.2 can u try upate this packages to this version? Commented Apr 1, 2021 at 12:22

5 Answers 5

12

The issue is with npm7 requiring peer deps to be installed. This is a feature of npm7, not a bug. react-spring is the global package for the library and therefore contains all our targets. Unless you really are doing an app that requires zDog, konva etc. I would install the specific target you're after.

i.e npm install @react-spring/web the /* can be replaced with any target we support, for more information please see the docs

Sign up to request clarification or add additional context in comments.

2 Comments

Coming from the GitHub issue I've opened. Thank you for adding your answer here @Josh! In my case, I needed @react-spring/web only for Next.js.
Thanks, I will try it out. P.S. I guess it will make my Stack Overflow glory down. But it was worth the run. :)
10

Had the same problem, this suggestion fixed the installation error. Still didn't try to work with it though. Basically, we should add

"peerDependencies": {
  "react-spring": "^8.x"
}

to the package.json file

3 Comments

Worked with it now, may confirm that this solution works. :)
For me, it automaitclaly installs up to React-Spring v7. Can we upgrade it to V9?
I don 't think is the correct answer. It's probably to do with npm7 requiring all the peer deps to be in the project.
0

Got the similar kind of problem when added "@twilio/video-room-monitor": "^1.0.1" dependency and resolved by adding "react-spring" in dependencies, reference link

 "dependencies": {
 "react-spring": "^9.6.1"

}

Comments

0

In my situation:

I'm using import { useSpring, animated } from '@react-spring/web';
instead of import { useSpring, animated } from 'react-spring/web';

  • I installed only "@react-spring/web": "^9.7.5",

  • I don't need to install the @types, I don't need to install the full react-spring.

  • I'm using pnpm.

Comments

-2

I had the same problem using React 17.0.2 but success with run npm install -g react-spring and then go without errors but still a lot of warnings

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.