在我从 Expo SDK 40 升级到 SDK 43 之后,npm start
我得到了这个错误"Unable to resolve module @unimodules/core"
。
然后我检查了我的package.json
,我没有安装这个包。
任何帮助将不胜感激。
完整的错误堆栈跟踪:
Warning: https://github.com/expo/react-native/archive/sdk-43.0.0.tar.gz is not a valid version. Version must be in the form of sdk-x.y.z. Please update your package.json file.
info Launching Dev Tools...
iOS Bundling failed 4235ms
Unable to resolve module @unimodules/core from /Users/user/path/to/project/node_modules/expo-linking/build/Linking.js: @unimodules/core could not be found within the project or in these directories:
node_modules
../../../../node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
> 1 | import { Platform, UnavailabilityError } from '@unimodules/core';
| ^
2 | import Constants from 'expo-constants';
3 | import invariant from 'invariant';
4 | import qs from 'qs';
这是我的 package.json:
{
"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"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.13.3",
"@react-native-community/art": "^1.2.0",
"@react-native-community/datetimepicker": "3.0.4",
"@react-native-community/masked-view": "0.1.10",
"@react-native-community/netinfo": "5.9.7",
"@react-native-community/push-notification-ios": "^1.2.2",
"@react-native-community/slider": "3.0.3",
"@react-navigation/native": "^5.1.4",
"aws-amplify": "^3.3.1",
"aws-amplify-react-native": "^4.2.6",
"axios": "^0.19.2",
"expo": "^43.0.0",
"expo-app-loading": "^1.0.1",
"expo-barcode-scanner": "~9.1.0",
"expo-camera": "~9.1.0",
"expo-constants": "~9.3.3",
"expo-font": "~8.4.0",
"expo-linking": "~2.0.1",
"expo-mail-composer": "~9.0.0",
"expo-notifications": "~0.8.2",
"expo-permissions": "~10.0.0",
"expo-secure-store": "~9.3.0",
"expo-sqlite": "~8.5.0",
"expo-updates": "~0.4.1",
"expo-web-browser": "~8.6.0",
"file-saver": "^2.0.2",
"jsbarcode": "^3.11.3",
"link": "^0.1.5",
"qs": "^6.9.4",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-43.0.0.tar.gz",
"react-native-barcode-expo": "^1.1.1",
"react-native-elements": "^3.2.0",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "~1.8.0",
"react-native-modal": "^11.5.6",
"react-native-modal-datetime-picker": "^8.6.0",
"react-native-paper": "^3.10.1",
"react-native-push-notification": "^3.5.2",
"react-native-reanimated": "~1.13.0",
"react-native-router-flux": "^4.2.0",
"react-native-safe-area-context": "3.1.9",
"react-native-screens": "~2.15.2",
"react-native-snap-carousel": "^3.9.1",
"react-native-svg": "12.1.0",
"react-native-web": "~0.13.12",
"react-navigation-animated-switch": "^0.6.4",
"react-navigation-drawer": "^2.4.11",
"react-navigation-header-buttons": "^3.0.5",
"react-router-dom": "^6.0.0-alpha.3"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.9.2",
"@react-native-community/eslint-config": "^0.0.7",
"babel-jest": "^25.1.0",
"babel-preset-expo": "8.5.1",
"eslint": "^6.8.0",
"expo-cli": "^4.12.8",
"jest": "^25.5.4",
"jest-expo": "~43.0.1",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "^16.13.1"
},
"private": true
}