ERROR Invariant Violation: Module AppRegistry is not a registered callable module ( React native V6)
See original GitHub issueDescription
ERROR TypeError: undefined is not an object (evaluating ‘Object.keys(o)’) ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
Version
0.67
Output of npx react-native info
BUNDLE ./index.js
ERROR TypeError: undefined is not an object (evaluating ‘Object.keys(o)’) ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. [Info] Stopping Packager
Steps to reproduce
Whenever i am adding StackNavigator code in my App.js then showing above issue… I tried all possible solution to resolve it. but it’s showing same bug again and again.
Snack, code example, screenshot, or link to a repository
App.js `import {NavigationContainer} from ‘@react-navigation/native’; import React from ‘react’; import ‘react-native-gesture-handler’; import {createStackNavigator} from ‘react-navigation-stack’; import Home from ‘./Home’;
const Stack = createStackNavigator(); const SectionListBasics = () => { return ( <> <NavigationContainer> <Stack.Navigator initialRouteName=“Home” headerMode=“Screen”> <Stack.Screen name=“Home” options={{ headerShown: false, }}> {props => <Home {…props} username=“Sports Fan” />} </Stack.Screen> </Stack.Navigator> </NavigationContainer> </> ); };
export default SectionListBasics; `
package.json
{ "name": "AwesomeProject", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@react-native-community/masked-view": "^0.1.11", "@react-navigation/bottom-tabs": "^6.0.9", "@react-navigation/drawer": "^6.1.8", "@react-navigation/native": "^6.0.6", "react": "17.0.2", "react-native": "0.67.1", "react-native-gesture-handler": "^2.2.0", "react-native-reanimated": "^2.2.4", "react-native-safe-area-context": "^3.3.2", "react-native-screens": "^3.10.2", "react-native-vector-icons": "^9.0.0", "react-navigation-stack": "^2.10.4" }, "devDependencies": { "@babel/core": "7.16.10", "@babel/runtime": "7.16.7", "@react-native-community/eslint-config": "2.0.0", "babel-jest": "26.6.3", "eslint": "7.14.0", "jest": "26.6.3", "metro-react-native-babel-preset": "0.66.2", "react-test-renderer": "17.0.2" }, "jest": { "preset": "react-native" } }
Issue Analytics
- State:
- Created 2 years ago
- Comments:30
Top GitHub Comments
This issue is mostly happen when
node_modules
folder has been changed by installing new library or some sort of action. Please try removing cache and doyarn install
ornpm install
againTry to add this line in the file where you add the navigation:
this has worked for me.