我有一个在 Expo(49) 上运行的 React 本机应用程序。由于该版本很快就被弃用并且无法与 expo go 应用程序一起使用,因此我们需要升级 sdk。当我们尝试时,问题开始增多。 我有一个 NPM 依赖性错误。我在 Windows 上,典型的标志 --legacy-peer-deps 和审计修复不能解决任何问题,更多会使情况变得更糟。
有谁知道如何解决这些依赖树错误?
我已经删除了一些已弃用的软件包,删除了node_modules和package-lock,使用工具更改了软件包版本,但没有任何效果
Package.json:
{
"name": "firstreactnativeapp",
"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": {
"@react-native-async-storage/async-storage": "1.23.1",
"@react-navigation/bottom-tabs": "^6.5.10",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.15",
"@react-spring/native": "^9.5.5",
"@react-spring/web": "^9.7.3",
"@types/react": "~18.2.45",
"expo": "^51.0.8",
"expo-blur": "~13.0.2",
"expo-linear-gradient":
"~13.0.2",
"expo-location": "~17.0.1",
"expo-splash-screen": "~0.27.4",
"expo-status-bar": "~1.12.1",
"firebase": "^10.5.2",
"formik": "^2.4.5",
"react": "^18.3.1",
"react-native": "0.74.1",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1",
"react-native-vector-icons": "^10.0.0",
"react-native-webview": "13.8.6",
"react-tinder-card": "^1.6.4"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"typescript": "^5.3.3"
},
"private": true
}
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
npm ERR! peer react@"*" from @react-native/[email protected]
npm ERR! node_modules/@react-native/virtualized-lists
npm ERR! @react-native/virtualized-lists@"0.74.83" from [email protected]
pm ERR! peer react@"*" from @react-navigation/[email protected]
npm ERR! node_modules/@react-navigation/bottom-tabs
npm ERR! @react-navigation/bottom-tabs@"^6.5.10" from the root project
npm ERR! 21 more (@react-navigation/core, @react-navigation/elements, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"18.2.0" from [email protected]
npm ERR! node_modules/react-native
npm ERR! peer react-native@"^0.0.0-0 || >=0.60 <1.0" from @react-native-async-storage/[email protected]
npm ERR! node_modules/@react-native-async-storage/async-storage
npm ERR! peerOptional @react-native-async-storage/async-storage@"^1.18.1" from @firebase/[email protected]
npm ERR! node_modules/@firebase/auth
npm ERR! @firebase/auth@"1.7.4" from @firebase/[email protected]
npm ERR! node_modules/@firebase/auth-compat npm ERR! 1 more (firebase)
npm ERR! 1 more (the root project)
npm ERR! peer react-native@"*" from @react-native/[email protected]
npm ERR! node_modules/@react-native/virtualized-lists
npm ERR! @react-native/virtualized-lists@"0.74.83" from [email protected]
npm ERR! 10 more (@react-navigation/bottom-tabs, ...)
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"18.2.0" from [email protected]
npm ERR! node_modules/react-native
npm ERR! peer react-native@"^0.0.0-0 || >=0.60 <1.0" from @react-native-async-storage/[email protected]
npm ERR! node_modules/@react-native-async-storage/async-storage
npm ERR! peerOptional @react-native-async-storage/async-storage@"^1.18.1" from @firebase/[email protected]
npm ERR! node_modules/@firebase/auth
npm ERR! @firebase/auth@"1.7.4" from @firebase/[email protected]
npm ERR! node_modules/@firebase/auth-compat
npm ERR! 1 more (firebase)
npm ERR! 1 more (the root project)
npm ERR! peer react-native@"*" from @react-native/[email protected]
npm ERR! node_modules/@react-native/virtualized-lists
npm ERR! @react-native/virtualized-lists@"0.74.83" from [email protected]
npm ERR! 10 more (@react-navigation/bottom-tabs, ...)
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.
我尝试从 expo SDK49 更新到版本 51 并预计可以正常工作,但现在我遇到了 npm 依赖错误
试试这个:
npx expo install --fix