我正在尝试将react-spring添加到gatsby (Gatsby 3.13.0,React 17.0.2)中。当我输入"npm I react-spring“时,会出现这样的错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @react-spring/core@9.2.4
npm ERR! node_modules/@react-spring/core
npm ERR! @react-spring/core@"~9.2.0" from react-spring@9.2.4
npm ERR! node_modules/react-spring
npm ERR! react-spring@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from react-reconciler@0.20.4
npm ERR! node_modules/react-zdog/node_modules/react-reconciler
npm ERR! react-reconciler@"^0.20.4" from react-zdog@1.0.11
npm ERR! node_modules/react-zdog
npm ERR! peer react-zdog@">=1.0" from @react-spring/zdog@9.2.4
npm ERR! node_modules/@react-spring/zdog
npm ERR! @react-spring/zdog@"~9.2.0" from react-spring@9.2.4
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! 我试过--force,或者--legacy peer-deps,但是没有用。React 17或Gatsby有问题吗?
发布于 2021-10-08 08:12:13
我会安装您正在使用的特定目标。例如,由于您使用的是gatsby,因此我假设您将使用@react-spring/web,这应该可以解决npm@7的问题。
https://stackoverflow.com/questions/69305772
复制相似问题