npm 如何在expo go项目中不使用--force或--legacy-peer-deps修复上游依赖冲突

r1zhe5dt  于 12个月前  发布在  Go
关注(0)|答案(1)|浏览(222)
npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react-native-reanimated
npm ERR!   react-native-reanimated@"~2.14.4" from the root project
npm ERR!   peer react-native-reanimated@">= 1.0.0" from @react-navigation/[email protected]
npm ERR!   node_modules/@react-navigation/drawer
npm ERR!     @react-navigation/drawer@"^6.4.1" from the root project
npm ERR!   2 more (react-native-circular-progress-indicator, react-native-redash)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-reanimated@">=3.0.0" from [email protected]
npm ERR! node_modules/react-native-reanimated-carousel
npm ERR!   react-native-reanimated-carousel@"^3.5.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react-native-reanimated
npm ERR!   peer react-native-reanimated@">=3.0.0" from [email protected]
npm ERR!   node_modules/react-native-reanimated-carousel
npm ERR!     react-native-reanimated-carousel@"^3.5.1" from the root project
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!
npm ERR! For a full report see:
npm ERR! D:\Programs\node_modules\npm-cache\_logs\2023-11-22T06_16_20_315Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: D:\Programs\node_modules\npm-cache\_logs\2023-11-22T06_16_20_315Z-debug-0.log

字符串
我正在尝试eas构建,但依赖关系中存在冲突。npm install exited with non-zero code: 1
这个问题可以使用--force或--legacy-peer-deps绕过,但它似乎不能解决问题本身。
我已经尝试使用npm配置设置legacy-peer-deps true。
但我认为这不是你解决问题的方式
总之,该错误表示项目中不同包所需的react-native-reanimated版本存在冲突。需要调整依赖项或使用建议的标志来强制安装。
我使用npm ls react-native-reanimated解决了这个问题,并删除了冲突的包。

i34xakig

i34xakig1#

转到你的package.json并在deependancies部分添加:

"react-native-reanimated" : "^3.0.0"

字符串
再次运行npm install,你应该没问题。如果没有,发布你的package.json。
作为一个旁注,请使用正确的格式为代码和错误信息在未来。当你张贴它作为明文在一个巨大的斑点,它只是变得不可能阅读。
我能够找到一组工作的软件包,它只是不包括react-native-svg-charts。我会看看我是否能做更多,但这是我迄今为止找到的最好的解决方案。

+-- @babel/[email protected]
+-- @babel/[email protected]
+-- @react-native-community/[email protected]
+-- @react-native-picker/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- @react-navigation/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

相关问题