'ERORR after upgrading to Expo SDK 43 - Unable to resolve module @unimodules/core
After I upgraded from Expo SDK 40 to SDK 43 and did npm start
I got this error "Unable to resolve module @unimodules/core"
.
I then checked my package.json
and I didn't have this package installed.
Any help will be greatly appreciated.
Full Error Stack Trace:
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';
Here is my 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
}
Solution 1:[1]
I included the "@unimodules/core": "~7.2.0" in my project, and now it works. And then I could upgrade to 43 and 44 expo version.
Solution 2:[2]
All fixed! The issue was Expo replaced react-native-unimodules in SDK 43 to the expo. https://github.com/expo/fyi/blob/main/expo-modules-migration.md
Steps:
- Remove node_modules
- Remove package-lock.json
- Run expo upgrade 43 (to ensure package versions are all aligned)
- Run expo start -c
Solution 3:[3]
I tried to upgrade my project from 42 to 44, but I got this same issue. It seams to be a problem with another lib wichs containg unimodules, expo-constants. I tried to remove it, but a lot of others lib depending on it. So, I coundn't resolve it.
Solution 4:[4]
It happened to me, so in my case I did fix this issue by removing expo-constants
and upgrading expo-analytics
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Filipe Lopes |
Solution 2 | Shahryar Faraji |
Solution 3 | Filipe Lopes |
Solution 4 | AZZ_B |