在 React Native 中安装包时 NPM 错误 eresolve

问题描述 投票:0回答:0

当我尝试在我的 expo react 本机应用程序上安装包甚至更新包时,我收到此错误消息:

@davidguri ➜ /workspaces/EK-Student (main) $ npm i
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @react-aria/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   react@"18.1.0" from the root project
npm WARN   112 more (@callstack/react-theme-provider, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0 || ^17.0.0-rc.1" from @react-aria/[email protected]
npm WARN node_modules/@react-aria/tabs
npm WARN   @react-aria/tabs@"3.0.0-alpha.2" from @react-native-aria/[email protected]
npm WARN   node_modules/@react-native-aria/tabs
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^16.8.0 || ^17.0.0-rc.1" from @react-aria/[email protected]
npm WARN   node_modules/@react-aria/tabs
npm WARN     @react-aria/tabs@"3.0.0-alpha.2" from @react-native-aria/[email protected]
npm WARN     node_modules/@react-native-aria/tabs
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @react-native-community/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"18.1.0" from the root project
npm ERR!   peer react@">=16.3.0" from @callstack/[email protected]
npm ERR!   node_modules/@callstack/react-theme-provider
npm ERR!     @callstack/react-theme-provider@"^3.0.7" from [email protected]
npm ERR!     node_modules/react-native-button-toggle-group/node_modules/react-native-paper
npm ERR!       react-native-paper@"^4.9.2" from [email protected]
npm ERR!       node_modules/react-native-button-toggle-group
npm ERR!         react-native-button-toggle-group@"^1.1.2" from the root project
npm ERR!     @callstack/react-theme-provider@"^3.0.8" from [email protected]
npm ERR!     node_modules/react-native-paper
npm ERR!       react-native-paper@"^5.2.0" from the root project
npm ERR!   111 more (@react-aria/checkbox, @react-stately/checkbox, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0" from @react-native-community/[email protected]
npm ERR! node_modules/@react-native-community/masked-view
npm ERR!   @react-native-community/masked-view@"0.1.10" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"^16.0" from @react-native-community/[email protected]
npm ERR!   node_modules/@react-native-community/masked-view
npm ERR!     @react-native-community/masked-view@"0.1.10" 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! /home/codespace/.npm/_logs/2023-04-01T12_58_50_496Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/codespace/.npm/_logs/2023-04-01T12_58_50_496Z-debug-0.log

我尝试重新安装 npm、node、expo,甚至尝试使用 github codespaces 在线运行代码以检查问题是否出在本地。 (剧透,事实并非如此)。我该如何解决这个错误?

react-native npm terminal expo npm-start
© www.soinside.com 2019 - 2024. All rights reserved.