我有一个刚刚迁移到SDK 48的Expo应用程序。
我有以下设置:
NodeJS: 18.15.0
NPM: 9.6.3
当我这样做:npm install
时,我得到以下错误:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @koale/useworker@4.0.2
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN react@"18.2.0" from the root project
npm WARN 30 more (@react-native-firebase/app, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from @koale/useworker@4.0.2
npm WARN node_modules/@koale/useworker
npm WARN @koale/useworker@"^4.0.2" from expo-camera@13.2.1
npm WARN node_modules/expo-camera
npm WARN
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from @koale/useworker@4.0.2
npm WARN node_modules/@koale/useworker
npm WARN @koale/useworker@"^4.0.2" from expo-camera@13.2.1
npm WARN node_modules/expo-camera
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-test-renderer@17.0.2
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"18.2.0" from the root project
npm ERR! peer react@"*" from @react-native-firebase/app@17.4.2
npm ERR! node_modules/@react-native-firebase/app
npm ERR! @react-native-firebase/app@"^17.4.2" from the root project
npm ERR! peer @react-native-firebase/app@"17.4.2" from @react-native-firebase/analytics@17.4.2
npm ERR! node_modules/@react-native-firebase/analytics
npm ERR! @react-native-firebase/analytics@"17.4.2" from the root project
npm ERR! 29 more (@react-native-picker/picker, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.2" from react-test-renderer@17.0.2
npm ERR! node_modules/react-test-renderer
npm ERR! dev react-test-renderer@"^17.0.2" from the root project
npm ERR! peer react-test-renderer@">=16.8.0" from @testing-library/react-native@12.0.1
npm ERR! node_modules/@testing-library/react-native
npm ERR! @testing-library/react-native@"^12.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@17.0.2
npm ERR! node_modules/react
npm ERR! peer react@"17.0.2" from react-test-renderer@17.0.2
npm ERR! node_modules/react-test-renderer
npm ERR! dev react-test-renderer@"^17.0.2" from the root project
npm ERR! peer react-test-renderer@">=16.8.0" from @testing-library/react-native@12.0.1
npm ERR! node_modules/@testing-library/react-native
npm ERR! @testing-library/react-native@"^12.0.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.
我祈求帮助!!求你了!
这是我的包。json:
{
"name": "migrated-app",
"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",
"eject": "expo eject",
"test": "jest",
"test:watch": "jest --watchAll",
"types:check": "tsc --noEmit"
},
"jest": {
"preset": "jest-expo"
},
"resolutions": {
"@expo/config-plugins": "^5.0."
},
"dependencies": {
"@expo-google-fonts/inter": "^0.2.2",
"@expo-google-fonts/open-sans": "^0.2.2",
"@expo-google-fonts/roboto": "^0.2.2",
"@expo/vector-icons": "^13.0.0",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/netinfo": "9.3.7",
"@react-native-firebase/analytics": "17.4.2",
"@react-native-firebase/app": "^17.4.2",
"@react-native-picker/picker": "^2.4.8",
"@react-navigation/bottom-tabs": "^6.0.5",
"@react-navigation/drawer": "^6.4.1",
"@react-navigation/native": "^6.0.2",
"@react-navigation/native-stack": "^6.1.0",
"@sentry/react-native": "4.13.0",
"@testing-library/react-native": "^12.0.1",
"axios": "^0.27.2",
"deprecated-react-native-prop-types": "^2.3.0",
"expo": "^48.0.0",
"expo-ads-admob": "~13.0.0",
"expo-apple-authentication": "~6.0.1",
"expo-application": "~5.1.1",
"expo-asset": "~8.9.1",
"expo-build-properties": "^0.6.0",
"expo-camera": "^13.2.1",
"expo-constants": "~14.2.1",
"expo-crypto": "~12.2.1",
"expo-dev-client": "~2.2.1",
"expo-device": "~5.2.1",
"expo-facebook": "~12.2.0",
"expo-firebase-analytics": "^8.0.0",
"expo-font": "~11.1.1",
"expo-image-manipulator": "~11.1.1",
"expo-image-picker": "~14.1.1",
"expo-in-app-purchases": "~14.1.1",
"expo-linking": "~4.0.1",
"expo-location": "~15.1.1",
"expo-mail-composer": "~12.1.1",
"expo-notifications": "~0.18.1",
"expo-splash-screen": "~0.18.1",
"expo-status-bar": "~1.4.2",
"expo-updates": "~0.16.4",
"expo-web-browser": "~12.1.1",
"install": "^0.13.0",
"jest-circus": "^29.1.2",
"jotai": "^1.6.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.32.1",
"react-native": "0.71.6",
"react-native-autocomplete-input": "^5.1.0",
"react-native-bouncy-checkbox": "^2.1.10",
"react-native-gesture-handler": "~2.9.0",
"react-native-global-props": "^1.1.5",
"react-native-maps": "1.3.2",
"react-native-purchases": "^5.1.0",
"react-native-reanimated": "~2.14.4",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"react-native-uuid": "^2.0.1",
"react-native-web": "~0.18.7",
"react-native-webview": "11.26.0",
"react-query": "^3.39.1",
"sentry-expo": "~6.1.0"
},
"devDependencies": {
"@babel/core": "^7.19.3",
"@types/react": "~18.0.24",
"@types/react-native": "~0.70.6",
"@types/react-native-autocomplete-input": "^5.1.0",
"@types/react-native-global-props": "^1.1.1",
"detox": "^19.12.5",
"husky": "^7.0.4",
"lint-staged": "^12.4.1",
"prettier": "2.6.2",
"pretty-quick": "^3.1.3",
"react-test-renderer": "^17.0.2",
"typescript": "^4.6.3"
},
"private": true,
"engines": {
"npm": ">=7.0.0",
"node": "18.15.0"
},
"lint-staged": {
"*.{jsx,tsx,ts,js,css,md}": "prettier --write",
"*.{js,css,md}": "prettier --write"
},
"detox": {
"test-runner": "jest",
"configurations": {
"ios.sim": {
"binaryPath": "bin/Exponent.app",
"type": "ios.simulator",
"name": "iPhone 11"
}
}
}
}
1条答案
按热度按时间9w11ddsr1#
我找到了解决问题的方法。
1.首先我更改为NodeJS 16.15.0
1.然后,将react-test-renderer的版本升级到18.2.0
这解决了npm install的所有问题