依赖关系与react@17.0.2@apollo/react-common@3.1.4
我在我的React项目中使用@APOLLO,并且我一直在遇到此错误
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @apollo/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR! peerOptional react@"^16.8.0 || ^17.0.0 || ^18.0.0" from @apollo/[email protected]
npm ERR! node_modules/@apollo/client
npm ERR! @apollo/client@"^3.6.8" from the root project
npm ERR! @apollo/client@"latest" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-components
npm ERR! @apollo/react-components@"^4.0.0" from the root project
npm ERR! 1 more (@apollo/react-hooks)
npm ERR! 18 more (@emotion/react, @material-ui/core, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-common
npm ERR! @apollo/react-common@"^3.1.4" from the root project
npm ERR! @apollo/react-common@"^3.1.4" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-ssr
npm ERR! @apollo/react-ssr@"^3.1.5" from [email protected]
npm ERR! node_modules/react-apollo
npm ERR! react-apollo@"^3.1.5" from the root project
npm ERR! 5 more (@apollo/react-hooks, react-apollo, ...)
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^16.8.0" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-common
npm ERR! @apollo/react-common@"^3.1.4" from the root project
npm ERR! @apollo/react-common@"^3.1.4" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-ssr
npm ERR! @apollo/react-ssr@"^3.1.5" from [email protected]
npm ERR! node_modules/react-apollo
npm ERR! react-apollo@"^3.1.5" from the root project
npm ERR! 5 more (@apollo/react-hooks, react-apollo, ...)
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 /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-06-17T09_09_33_753Z-debug-0.log
make: *** [Makefile:35: node_modules] Error 1
Error: Process completed with exit code 2.
,我尝试使用-Legacy-Peer-Deps
,但徒劳无功。 jfy,我正在使用这些依赖项
- “@apollo/client”:“^3.6.8”
- “@apollo/react-common”:“^3.1.4”
- “@apollo/react-components”:“^4.0.0”
- “@apollo/react-hooks”:“^4.0.0”
- “反应”:“^17.0.2”
I am using @apollo in my react project and I keep getting this error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @apollo/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR! peerOptional react@"^16.8.0 || ^17.0.0 || ^18.0.0" from @apollo/[email protected]
npm ERR! node_modules/@apollo/client
npm ERR! @apollo/client@"^3.6.8" from the root project
npm ERR! @apollo/client@"latest" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-components
npm ERR! @apollo/react-components@"^4.0.0" from the root project
npm ERR! 1 more (@apollo/react-hooks)
npm ERR! 18 more (@emotion/react, @material-ui/core, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-common
npm ERR! @apollo/react-common@"^3.1.4" from the root project
npm ERR! @apollo/react-common@"^3.1.4" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-ssr
npm ERR! @apollo/react-ssr@"^3.1.5" from [email protected]
npm ERR! node_modules/react-apollo
npm ERR! react-apollo@"^3.1.5" from the root project
npm ERR! 5 more (@apollo/react-hooks, react-apollo, ...)
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^16.8.0" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-common
npm ERR! @apollo/react-common@"^3.1.4" from the root project
npm ERR! @apollo/react-common@"^3.1.4" from @apollo/[email protected]
npm ERR! node_modules/@apollo/react-ssr
npm ERR! @apollo/react-ssr@"^3.1.5" from [email protected]
npm ERR! node_modules/react-apollo
npm ERR! react-apollo@"^3.1.5" from the root project
npm ERR! 5 more (@apollo/react-hooks, react-apollo, ...)
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 /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-06-17T09_09_33_753Z-debug-0.log
make: *** [Makefile:35: node_modules] Error 1
Error: Process completed with exit code 2.
I tried to use the --legacy-peer-deps
but in vain.
JFY, I am using these dependencies
- "@apollo/client": "^3.6.8"
- "@apollo/react-common": "^3.1.4"
- "@apollo/react-components": "^4.0.0"
- "@apollo/react-hooks": "^4.0.0"
- "react": "^17.0.2"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将React版本降级到
React@“^16.8.0”
inpackage.json
是因为@apollo/ [email  nbsp; procepted]
报告与17不兼容。You should downgrade your react version to
react@"^16.8.0"
inpackage.json
because@apollo/[email protected]
reports is incompatible with 17. You must wait until they upgrade or remove the package.