我尝试在react-native中安装以下软件包:
npx expo安装@React导航/本机@5.9.8 @React导航/堆栈@5.14.9React Native重新激活的React Native手势处理程序React Native屏幕React Native安全区域上下文@React Native社区/屏蔽视图expo常量
它抛出了以下错误日志:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite@1.0.0
npm WARN Found: react-native-safe-area-context@3.4.1
npm WARN node_modules/react-native-safe-area-context
npm WARN react-native-safe-area-context@"4.3.1" from the root project
npm WARN 2 more (react-native-elements, @react-navigation/stack)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-native-safe-area-context@"^3.1.9" from react-native-elements@3.4.2
npm WARN node_modules/react-native-elements
npm WARN react-native-elements@"3.4.2" from the root project
npm WARN deprecated @react-native-community/masked-view@0.1.11: Repository was moved to @react-native-masked-view/masked-view
added 25 packages, removed 1 package, changed 2 packages, and audited 1185 packages in 12s
54 packages are looking for funding
run `npm fund` for details
6 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
> npm install --save @react-native-community/masked-view
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-native-elements@3.4.2
npm ERR! Found: react-native-safe-area-context@4.3.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! peer react-native-safe-area-context@">= 0.6.0" from @react-navigation/stack@5.14.9
npm ERR! node_modules/@react-navigation/stack
npm ERR! @react-navigation/stack@"5.14.9" from the root project
npm ERR! react-native-safe-area-context@"4.3.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-safe-area-context@"^3.1.9" from react-native-elements@3.4.2
npm ERR! node_modules/react-native-elements
npm ERR! react-native-elements@"3.4.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native-safe-area-context@3.4.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! peer react-native-safe-area-context@"^3.1.9" from react-native-elements@3.4.2
npm ERR! node_modules/react-native-elements
npm ERR! react-native-elements@"3.4.2" 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! C:\Users\isena\AppData\Local\npm-cache\_logs\2022-12-09T22_33_54_680Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\isena\AppData\Local\npm-cache\_logs\2022-12-09T22_33_54_680Z-debug-0.log
这是我包-json:
{
"name": "nucampsite",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "^46.0.13",
"expo-status-bar": "^1.4.0",
"react": "^18.0.0",
"react-native": "^0.69.6",
"react-native-elements": "3.4.2",
"@react-navigation/native": "5.9.8",
"@react-navigation/stack": "5.14.9",
"react-native-reanimated": "~2.9.1",
"react-native-gesture-handler": "~2.5.0",
"react-native-screens": "~3.15.0",
"react-native-safe-area-context": "4.3.1",
"expo-constants": "~13.2.4"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
我已经尝试更新React与npm安装React@最新
它向我抛出了以下错误日志:
npm install react@latest
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite@1.0.0
npm WARN Found: react@18.0.0
npm WARN node_modules/react
npm WARN peer react@">=16.0" from @react-native-community/masked-view@0.1.11
npm WARN node_modules/@react-native-community/masked-view
npm WARN peer @react-native-community/masked-view@">= 0.1.0" from @react-navigation/stack@5.14.9
npm WARN node_modules/@react-navigation/stack
npm WARN 13 more (@react-navigation/core, @react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"18.0.0" from react-native@0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native@"*" from @react-native-community/cli@8.0.6
npm WARN node_modules/@react-native-community/cli
npm WARN 11 more (@react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite@1.0.0
npm WARN Found: react@18.0.0
npm WARN node_modules/react
npm WARN peer react@">=16.0" from @react-native-community/masked-view@0.1.11
npm WARN node_modules/@react-native-community/masked-view
npm WARN peer @react-native-community/masked-view@">= 0.1.0" from @react-navigation/stack@5.14.9
npm WARN node_modules/@react-navigation/stack
npm WARN 13 more (@react-navigation/core, @react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"18.0.0" from react-native@0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native@"*" from @react-native-community/cli@8.0.6
npm WARN node_modules/@react-native-community/cli
npm WARN 11 more (@react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite@1.0.0
npm WARN Found: react@18.0.0
npm WARN node_modules/react
npm WARN peer react@">=16.0" from @react-native-community/masked-view@0.1.11
npm WARN node_modules/@react-native-community/masked-view
npm WARN peer @react-native-community/masked-view@">= 0.1.0" from @react-navigation/stack@5.14.9
npm WARN node_modules/@react-navigation/stack
npm WARN 13 more (@react-navigation/core, @react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"18.0.0" from react-native@0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native@"*" from @react-native-community/cli@8.0.6
npm WARN node_modules/@react-native-community/cli
npm WARN 11 more (@react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite@1.0.0
npm WARN Found: react@18.0.0
npm WARN node_modules/react
npm WARN peer react@">=16.0" from @react-native-community/masked-view@0.1.11
npm WARN node_modules/@react-native-community/masked-view
npm WARN peer @react-native-community/masked-view@">= 0.1.0" from @react-navigation/stack@5.14.9
npm WARN node_modules/@react-navigation/stack
npm WARN 13 more (@react-navigation/core, @react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"18.0.0" from react-native@0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native@"*" from @react-native-community/cli@8.0.6
npm WARN node_modules/@react-native-community/cli
npm WARN 11 more (@react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite@1.0.0
npm WARN Found: react@18.0.0
npm WARN node_modules/react
npm WARN peer react@">=16.0" from @react-native-community/masked-view@0.1.11
npm WARN node_modules/@react-native-community/masked-view
npm WARN peer @react-native-community/masked-view@">= 0.1.0" from @react-navigation/stack@5.14.9
npm WARN node_modules/@react-navigation/stack
npm WARN 13 more (@react-navigation/core, @react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"18.0.0" from react-native@0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native@"*" from @react-native-community/cli@8.0.6
npm WARN node_modules/@react-native-community/cli
npm WARN 11 more (@react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite@1.0.0
npm WARN Found: react@18.0.0
npm WARN node_modules/react
npm WARN peer react@">=16.0" from @react-native-community/masked-view@0.1.11
npm WARN node_modules/@react-native-community/masked-view
npm WARN peer @react-native-community/masked-view@">= 0.1.0" from @react-navigation/stack@5.14.9
npm WARN node_modules/@react-navigation/stack
npm WARN 13 more (@react-navigation/core, @react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"18.0.0" from react-native@0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native@"*" from @react-native-community/cli@8.0.6
npm WARN node_modules/@react-native-community/cli
npm WARN 11 more (@react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite@1.0.0
npm WARN Found: react@18.0.0
npm WARN node_modules/react
npm WARN peer react@">=16.0" from @react-native-community/masked-view@0.1.11
npm WARN node_modules/@react-native-community/masked-view
npm WARN peer @react-native-community/masked-view@">= 0.1.0" from @react-navigation/stack@5.14.9
npm WARN node_modules/@react-navigation/stack
npm WARN 13 more (@react-navigation/core, @react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"18.0.0" from react-native@0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native@"*" from @react-native-community/cli@8.0.6
npm WARN node_modules/@react-native-community/cli
npm WARN 11 more (@react-native-community/masked-view, ...)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-native-elements@3.4.2
npm ERR! Found: react-native-safe-area-context@4.3.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! peer react-native-safe-area-context@">= 0.6.0" from @react-navigation/stack@5.14.9
npm ERR! node_modules/@react-navigation/stack
npm ERR! @react-navigation/stack@"5.14.9" from the root project
npm ERR! react-native-safe-area-context@"4.3.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-safe-area-context@"^3.1.9" from react-native-elements@3.4.2
npm ERR! node_modules/react-native-elements
npm ERR! react-native-elements@"3.4.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native-safe-area-context@3.4.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! peer react-native-safe-area-context@"^3.1.9" from react-native-elements@3.4.2
npm ERR! node_modules/react-native-elements
npm ERR! react-native-elements@"3.4.2" 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.
谢谢你的帮助!
1条答案
按热度按时间e0bqpujr1#
最新消息:
我发现的解决方法非常简单:我没有使用--force或--legacy-peer-deps强制安装,而是删除了下面这行
从我的package.json中删除。
我在一个编码训练营,这是我们和我们的导师想出的解决方案。