Module AppRegistry is not registered callable module (calling runApplication)
React NativeNative BaseReact Native Problem Overview
I am using native base for making app in react-native. I am new to both things. When I run the app It gives me this error:
Here is my code:
export default class Point extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='menu' />
</Button>
</Left>
<Body>
<Title>Header</Title>
</Body>
<Right />
</Header>
</Container>
);
}
}
Here is the screenshot of my versions
and nativebase version is "native-base": "^2.1.2"
React Native Solutions
Solution 1 - React Native
Just kill all node process and start npm server and run application:
Step1: run command killall -9 node
> For windows users, run: taskkill /im node.exe
>
> Run taskkill /f /im node.exe
if the process still persists.
Step2: run command npm start --reset-cache
Step3: run command react-native run-ios
OR react-native run-android
Solution 2 - React Native
Closing the current Metro Bundler and restarting by resetting the cache worked for me
npm start -- --reset-cache
Solution 3 - React Native
react-native start --reset-cacher
Solution 4 - React Native
You should have this at the bottom of the index.ios.js
file
AppRegistry.registerComponent('Point', () => Point);
and also import AppRegistry
from react-native
Solution 5 - React Native
I had this issue - it was odd because I reset my repo to a time when the app was working. The issue was with my simulator (iOS).
For me the solution was to
- kill the simulator program (quit)
- then - close the terminal window that is opened when simulator is ran (Metro Bundler) Image of my terminal window
Solution 6 - React Native
Close the current Metro Bundler and restart by typing the comment:
npm start -- --reset-cache
Solution 7 - React Native
Stop the node server running and run 'react-native run-ios' once again.
Solution 8 - React Native
I tend to get this error after I install a new package that has some native code that needs to be installed with it. Usually packages will say install npm module and then install native code via a pod install (ios specific) and after this my app usually throws this error.
In order to get rid of this error I delete and reinstall node_modules and pods since I am making an iOS app and then I also delete the build folder under ios. After that I run the packager with npm start -- --reset-cache and build my app again using the react-native run-ios command. This fixes the issue for me.
Solution 9 - React Native
Worked for me for below version and on iOS:
"react": "16.9.0",
"react-native": "0.61.5",
Step to resolve
Close the current running Metro Bundler
Try Re-run your Metro Bundler and check if this issue persists
Solution 10 - React Native
In my case, trying npm start -- --reset-cache
and getting a bunch more errors, I deleted (uninstalled) the app from iOS and Android and yarn ios
yarn android
did the trick.
Solution 11 - React Native
I was using native base for my app here is link [native base][1]
and you can see there is no app registry like this
AppRegistry.registerComponent('Point', () => Point)
but i have to do this to run my app [1]: https://docs.nativebase.io/Components.html#Components
Solution 12 - React Native
Just closing the metro bundler and rebuilding the app done my job.
Solution 13 - React Native
-
Close Emülator
-
npm start -- --reset-cache
-
XCode -> Product -> Clean Build Folder
-
npx react-native run-ios
Solution 14 - React Native
I tried killall -9 node
command in terminal
then again i run my project using npm start
and it's working fine
Solution 15 - React Native
I ended up creating an entirely new react-native project after a computer restart and after the deletion/rebuild of the npm_modules
folder, Pods
folder, and my ios build folder did not work. (Quitting the Simulator, Quitting the Terminal app, Quitting XCode, cleaning the project folder in XCode, and running killall -9 node
, npm start -- reset-cahce
& npm start -- --reset-cache
did not work, either). After installing all my packages, I copied and pasted my code from my old project to the new one. Same error. So then I started backtracking my most recent code changes, step by step. After reverting my most recent code changes, it worked. While adding new code little by little, I got an error telling me I forgot to import {StyleSheet} from 'react-native';
. I imported that, then continued adding my code that had previously led to the error (which was simply a react-native-elements
Button
and a StyleSheet
const styles
). All went well.
So, in the end, my only theory is that I had added too much code at once, and instead of telling me I forgot to import {StyleSheet}
like it should have, it instead threw me a vague and infuriating module AppRegistry
error.
Solution 16 - React Native
Need to replace
.setJSMainModulePath("index") with .setJSMainModulePath("index.android")
Solution 17 - React Native
If you are using windows and running yarn open cmd on admin mode' terminate and Restart the node process by typing this command.
Find the node: killall -9 node force to kill : taskkill /f /im node.exe Reset the cache : yarn start --reset-cache
Navigate to your project directory: cd myapp Re-Run your App : yarn android
Solution 18 - React Native
In my case, I didn't import a module in a component that I was using it in.
So, just check if you are importing the module you want to use...
Solution 19 - React Native
One of the libraries has not been linked. To check, just comment out in the package.json one by one the latest libraries added.
yarn remove libraryName.
Then run the app with xcode and puf !
Solution 20 - React Native
If your are building a new npm module and this rely on some other dependencies already added in your project, you need to add those dependencies in the package.json of the npm package as peer dependency.
package.json
"peerDependencies":{
"@org/your-dependency":">= 1.2.0"
}
[Tue Aug 31 2021 17:57:45.731] ERROR Error: Type oid already present, js engine: hermes
[Tue Aug 31 2021 17:57:45.732] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication), js engine: hermes
[Tue Aug 31 2021 17:57:45.732] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication), js engine: hermes
Solution 21 - React Native
For me, the issue was starting the metro bundler when there was an error in one of my styles. I had an error in my code from last night, and then my computer did a restart overnight. Trying to start everything up today resulted in this error along with Invariant Violation: Invalid prop 'position' of value 'fixed' supplied to
. Fixing the position
value resolved both errors.
Solution 22 - React Native
One single error but there might be multiple causes. Seeing a lot of diverse discussions in the community means this issue could be hard to find. Try to proceed with the following.
- There might be a missing import.
- There might be a missing configuration with the library you recently installed.
- You may not receive errors in Android but in IOS. Then one of the lib configurations in IOS is missing.
- Your cache needs to be reset if RN is upgraded.
If you still cannot find the issue with the above, remove some imports or screens from your App.js. Going with this you can find what exactly caused this error. This is how I found my issue after a day of research.
Solution 23 - React Native
closing your current metro bundle and run this :--
npm start -- --reset-cache
Solution 24 - React Native
For me, restarting my computer appears to be enough to clear this issue.
It's often required after I've switched between branches, or merged branches using git.
Solution 25 - React Native
This happens for one of these reasons:-
- Either, your app's entry file 'index.js' is corrupt due to syntax error or your React App could not load.
- Your
Metro Bundler
instance running is stale and corrupt.
Solution
-
Terminate already running
Metro Bundler
instance -
Reset Cache
react-native start --reset-cache
-
Delete
android/app/bulid
folder -
Start server again
Solution 26 - React Native
The solution is very simple just kill all the running nodes and restart your node server and rebuild your native application and it works.
For Linix:
killall -9 node
For Windows:
taskkill /im node.exe
For Android native App:
react-native run-android
For IOS native App:
react-native run-ios
Then finally,
npm start
Solution 27 - React Native
I was also suffering from the same error for windows OS. I resolved this by cleaning gradlew
.
The steps are:
cd android
gradlew clean
cd..
Solution 28 - React Native
> npm start -- --reset-cache > > react-native run-ios > works for me.
Solution 29 - React Native
import { AppRegistry } from 'react-native';
AppRegistry.registerComponent('your app name', () => point);
Solution 30 - React Native
You just need to close the metro server by control + c and then restart by npm start --reset-cache
Note: If that too doesn't work then just restart your computer, it'll definitely work then.