首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >依赖关系与react@17.0.2阿波罗/react冲突-通用@3.1.4

依赖关系与react@17.0.2阿波罗/react冲突-通用@3.1.4
EN

Stack Overflow用户
提问于 2022-06-17 09:30:50
回答 1查看 496关注 0票数 2

我在我的反应计划中使用“阿波罗”,我不断地收到这个错误。

代码语言:javascript
复制
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @apollo/react-common@3.1.4
npm ERR! Found: react@17.0.2
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/client@3.6.8
npm ERR!   node_modules/@apollo/client
npm ERR!     @apollo/client@"^3.6.8" from the root project
npm ERR!     @apollo/client@"latest" from @apollo/react-components@4.0.0
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/react-common@3.1.4
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/react-ssr@3.1.5
npm ERR!   node_modules/@apollo/react-ssr
npm ERR!     @apollo/react-ssr@"^3.1.5" from react-apollo@3.1.5
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: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.0" from @apollo/react-common@3.1.4
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/react-ssr@3.1.5
npm ERR!     node_modules/@apollo/react-ssr
npm ERR!       @apollo/react-ssr@"^3.1.5" from react-apollo@3.1.5
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"
  • "react":"^17.0.2"
EN

回答 1

Stack Overflow用户

发布于 2022-10-23 10:25:49

您应该降低react@"^16.8.0"package.json中的反应版本,因为@apollo/react-common@3.1.4报告与17不兼容。您必须等到它们升级或删除包。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72657239

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档