依赖关系与react@17.0.2@apollo/react-common@3.1.4

发布于 2025-02-08 19:13:03 字数 4015 浏览 1 评论 0原文

我在我的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

皓月长歌 2025-02-15 19:13:03

您应该将React版本降级到React@“^16.8.0” in package.json是因为@apollo/ [email  nbsp; procepted]报告与17不兼容。

You should downgrade your react version to react@"^16.8.0" in package.json because @apollo/[email protected] reports is incompatible with 17. You must wait until they upgrade or remove the package.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文