expo: Invariant Violation: "main" has not been registered
Summary
After some recent updates in my expo react-native app, I am now getting the following error on compilation of the app:
Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
I’ve tried running rm -rf node_modules and then running yarn install all over again, but when I run yarn start I keep getting the above error. Wasn’t a problem before. And if a module is failing to call AppRegistry.registerComponent I have no idea which one, because the error doesn’t specify.
I was initially getting errors re: missing Pixi modules, so I added each of those. But now I get this unspecific error.
I also see this error:
Error: Secure random number generation is not supported by this browser.
Use Chrome, Firefox or Internet Explorer 11
No idea what that’s referring to.
How can I troubleshoot these issues?
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
42.0.0
Environment
Expo CLI 4.13.0 environment info: System: OS: macOS 11.5.2 Shell: 5.8 - /bin/zsh Binaries: Node: 14.17.3 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.13 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7678000 Xcode: 13.1/13A1030d - /usr/bin/xcodebuild npmPackages: expo: ^43.0.0 => 43.0.4 react: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-navigation: ^4.4.4 => 4.4.4 npmGlobalPackages: expo-cli: 4.13.0 Expo Workflow: managed
Reproducible demo
{
"main": "node_modules/expo/AppEntry.js",
"version": "1.0.50",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"postinstall": "patch-package",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/samples": "2.1.1",
"@expo/vector-icons": "^12.0.0",
"@ptomasroos/react-native-multi-slider": "^1.0.0",
"@react-native-async-storage/async-storage": "^1.15.6",
"@react-native-community/datetimepicker": "3.5.2",
"@react-native-community/netinfo": "6.0.0",
"@unimodules/core": "~7.1.1",
"buffer": "^5.5.0",
"crypto-js": "^3.1.9-1",
"expo": "^42.0.0",
"expo-app-loading": "^1.1.2",
"expo-asset": "~8.3.2",
"expo-av": "~9.2.3",
"expo-constants": "~11.0.1",
"expo-device": "~3.3.0",
"expo-file-system": "~11.1.3",
"expo-gl": "~10.4.1",
"expo-image-manipulator": "~9.2.2",
"expo-linear-gradient": "~9.2.0",
"expo-location": "~12.1.2",
"expo-permissions": "~12.1.1",
"expo-pixi": "^1.2.0",
"expo-sqlite": "~9.2.1",
"expo-status-bar": "~1.0.4",
"fiction-expo-restart": "^1.0.4",
"isaac": "0.0.5",
"lodash.clonedeep": "^4.5.0",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",
"md5": "^2.2.1",
"moment": "^2.24.0",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",
"react": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
"react-native-autocomplete-input": "^5.0.2",
"react-native-bcrypt": "^2.4.0",
"react-native-draggable-flatlist": "^1.1.7",
"react-native-gesture-handler": "^1.10.3",
"react-native-input-scroll-view": "1.11.0",
"react-native-keyboard-aware-scroll-view": "^0.9.4",
"react-native-keyboard-aware-view": "^0.0.14",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-modal-selector": "^2.0.7",
"react-native-open-maps": "^0.3.3",
"react-native-pager-view": "^5.1.3",
"react-native-reanimated": "^1.0.0",
"react-native-screens": "^3.4.0",
"react-native-svg": "12.1.1",
"react-native-svg-charts": "^5.3.0",
"react-native-tab-view": "^3.0.1",
"react-navigation": "^4.4.4",
"react-navigation-drawer": "^2.7.1",
"react-navigation-stack": "^1.7.3",
"react-navigation-tabs": "^1.2.0",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"serialize-javascript": "^3.0.0",
"socket.io-client": "2.1.0",
"uuid": "^3.3.2"
},
"devDependencies": {
"babel-preset-expo": "8.3.0",
"jest": "^24.8.0",
"jest-expo": "^42.0.0"
},
"private": true
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (3 by maintainers)
ERROR Invariant Violation: “main” has not been registered. This can happen if:
AppRegistry.registerComponentwasn’t called., js engine: hermes위와같은 에러에 대한 해결방법을 찾지 못했습니다. 혹시 이 문제를 열은 @Muirik 은 답을 찾으셨습니까?
OS : Window { “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”: “~48.0.6”, “expo-status-bar”: “~1.4.4”, “react”: “18.2.0”, “react-native”: “^0.71.3”, “react-native-svg”: “13.4.0”, “svg”: “^0.1.0” }, “devDependencies”: { “@babel/core”: “^7.20.0”, “react-native-svg-transformer”: “^1.0.0” }, “private”: true } expo 환경에서 android studio 이용한 build를 했으나 실패했습니다.
I’m experiencing this issue only on release variants of android. Not an issue with debug variant and not an issue on any variant of iOS