Invariant Violation: Module AppRegistry is not a registered callabel module (calling runApplication)
Hugo-Meiring opened this issue Β· 158 comments
Currently on React Native 0.61.0-rc.3, updating to 0.61.1 causes this issue.
React Native version:
info Fetching system and libraries information...
System:
OS: macOS 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 871.19 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-29 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.1 => 0.61.1
npmGlobalPackages:
react-native-cli: 2.0.1
Steps To Reproduce
- Update the package.json values to use latest 0.61.1 (and other latest values pulled for a
react-native init) - Run the project (
yarn && cd ios && pod install && cd .. && yarn start+yarn ios)
Describe what you expected to happen:
The app should be running like on 0.61.0-rc.3. What major changes where made between the release candidate and 0.61.0 (also your website still show 0.60.0 as the latest version). Here is the source code changes between the two:
https://react-native-community.github.io/upgrade-helper/?from=0.61.0-rc.3&to=0.61.1
Snack, code example, screenshot, or link to a repository:
Can't be provided, production and private react-native init application.
Unfortunately, this error does not give any feedback on what exactly is wrong. You need to dig deeper.
Here are logs from Xcode:
2019-10-02 14:19:16.303 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
2019-10-02 14:19:16.305 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
2019-10-02 14:19:16.311 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 2 and callID 1 for module <unknown>. Args: '[{"app_state":"active"}]'
2019-10-02 14:19:16.313 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 18 and callID 9 for module <unknown>. Args: '[{"app_state":"active"}]'
2019-10-02 14:19:16.314 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 40 and callID 20 for module <unknown>. Args: '[{"app_state":"active"}]'
2019-10-02 14:19:16.317 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 2 and callID 1 for module <unknown>. Args: '[{"app_state":"active"}]'
2019-10-02 14:19:16.318 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 73 and callID 36 for module <unknown>. Args: '[0]'
2019-10-02 14:19:16.319 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 99 and callID 49 for module <unknown>. Args: '[1]'
2019-10-02 14:19:16.320 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 18 and callID 9 for module <unknown>. Args: '[{"app_state":"active"}]'
2019-10-02 14:19:16.322 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 123 and callID 61 for module <unknown>. Args: '[2]'
2019-10-02 14:19:16.323 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 139 and callID 69 for module <unknown>. Args: '[3]'
2019-10-02 14:19:16.323 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 155 and callID 77 for module <unknown>. Args: '[4]'
2019-10-02 14:19:16.324 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 40 and callID 20 for module <unknown>. Args: '[{"app_state":"active"}]'
2019-10-02 14:19:16.327 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 73 and callID 36 for module <unknown>. Args: '[0]'
2019-10-02 14:19:16.329 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 99 and callID 49 for module <unknown>. Args: '[1]'
2019-10-02 14:19:16.330278+0200 libertychat[59943:2042874] [] nw_proxy_resolver_create_parsed_array [C8 proxy pac] Evaluation error: NSURLErrorDomain: -1003
2019-10-02 14:19:16.330 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 171 and callID 85 for module <unknown>. Args: '[5]'
2019-10-02 14:19:16.331 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 187 and callID 93 for module <unknown>. Args: '[6]'
2019-10-02 14:19:16.367066+0200 libertychat[59943:2042874] [] nw_proxy_resolver_create_parsed_array [C10 proxy pac] Evaluation error: NSURLErrorDomain: -1003
2019-10-02 14:19:16.368 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 203 and callID 101 for module <unknown>. Args: '[7]'
2019-10-02 14:19:16.369 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 219 and callID 109 for module <unknown>. Args: '[8]'
2019-10-02 14:19:16.369 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 239 and callID 119 for module <unknown>. Args: '[9]'
2019-10-02 14:19:16.369809+0200 libertychat[59943:2042874] [] nw_proxy_resolver_create_parsed_array [C11 proxy pac] Evaluation error: NSURLErrorDomain: -1003
2019-10-02 14:19:16.376 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 123 and callID 61 for module <unknown>. Args: '[2]'
2019-10-02 14:19:16.381 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 139 and callID 69 for module <unknown>. Args: '[3]'
2019-10-02 14:19:16.385 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 155 and callID 77 for module <unknown>. Args: '[4]'
2019-10-02 14:19:16.390 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 171 and callID 85 for module <unknown>. Args: '[5]'
2019-10-02 14:19:16.393 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 187 and callID 93 for module <unknown>. Args: '[6]'
2019-10-02 14:19:16.393457+0200 libertychat[59943:2042874] [] nw_proxy_resolver_create_parsed_array [C12 proxy pac] Evaluation error: NSURLErrorDomain: -1003
2019-10-02 14:19:16.395 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 255 and callID 127 for module <unknown>. Args: '[10]'
2019-10-02 14:19:16.396 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 203 and callID 101 for module <unknown>. Args: '[7]'
2019-10-02 14:19:16.397 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 271 and callID 135 for module <unknown>. Args: '[11]'
2019-10-02 14:19:16.398 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 287 and callID 143 for module <unknown>. Args: '[12]'
2019-10-02 14:19:16.399 [error][tid:com.facebook.react.JavaScript] Invariant Violation: No callback found with cbID 303 and callID 151 for module <unknown>. Args: '[13]'
2019-10-02 14:19:16.399 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 219 and callID 109 for module <unknown>. Args: '[8]'
2019-10-02 14:19:16.403 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 239 and callID 119 for module <unknown>. Args: '[9]'
2019-10-02 14:19:16.446 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: No callback found with cbID 255 and callID 127 for module <unknown>. Args: '[10]'```
Did you try to enable the Debug option?
Getting this same issue but only on Android. Very weird :(
Did you try to enable the Debug option?
Yes, I also tried toggling Fast Refresh off.
Fixed the issue on my end by double checking that i modified all the files correctly during my RN upgrade, then running watchman watch-del-all, and react-native start --reset-cache. Then on android, build -> clean. then it worked! sigh
Unfortunately, it doesn't work our project (iOS) @m4rcoperuano. Glad it worked for you
It's hard to suggest anything without any more details, I would say that you can try commenting out some parts of your code and try until you find something.
Fixed the issue on my end by double checking that i modified all the files correctly during my RN upgrade, then running
watchman watch-del-all, andreact-native start --reset-cache. Then on android, build -> clean. then it worked! sigh
yeah me too,
react-native start --reset-cache
worked on my case
It's hard to suggest anything without any more details, I would say that you can try commenting out some parts of your code and try until you find something.
Ok will do. This will take a bit of time. We essentially have 2 apps that are linked so changes have to be done for 4 environments (2x iOS and 2x Android). Will report back if I find a solution to this.
@Hugo-Meiring Probably you use modules that were removed from react-native.
For example ViewPagerAndroid
So, unfortunately, I just can't get this working. If I get iOS working, Android breaks. If android is working, iOS breaks. This is just one of the issues that I ping pong between depending on the platform.
I can't spend more time on this as this is cutting into the release schedule. Will go with a temporary fix of splitting iOS and Android between different react versions and making adjustments to the CI/CD pipeline. A very nasty solution but it might be for the better. We can possibly move all our shared code to a separate repo while we analyze our options.
@Hugo-Meiring I'm facing a similar issue on a monorepo (using lerna and yarn workspaces).
Is this your case too?
I found that everything works ok when I start the app without using anything from an external package. Even the fast refresh works correctly if I comment the LOC related to external packages, start the app and finally un-comment those lines.
Also ran into this (setup below). Took a bit of @m4rcoperuano 's solution and just stopped my simulator and bundler, then removed everything in watchman via watchman watch-del-all. Restarted the simulator via react-native run-ios and everything works fine.
Setup
react-native-cli: 2.0.1
react-native: 0.61.2
mac OSmojave 10.14.6
This resolved it for me:
$ cd ios && rm -rf Pods && pod cache clean --all && pod install && cd ..
I forgot that I had done a "yarn add ..." on a few NPM modules and forgot to reinstall the pods.
I have fixed this error, can confirm it's because one of your libraries isn't linked correctly. Fastest way to fix this is starting from index.js to app.js commenting out imports. Once you've commented out enough libraries the app should work then you will know which library was not linked correctly. Some libraries that say they have auto-linking actually don't..... It's very tedious but this works and my app is now fully functioning!
Why does it have to be so difficult to find out WHICH Native Module cannot be null?
Hi! I have the same issue, both on android and iOS. I just remove node_modules and install again, it helps me) no other cleans or rebuilds has no effect(
This is just a vague error to tell you there's something wrong with one of your imports. It can have different causes and has different solutions for each cause. In my case, this was happening because of a circular dependency.
Also ran into this (setup below). Took a bit of @m4rcoperuano 's solution and just stopped my simulator and bundler, then removed everything in watchman via
watchman watch-del-all. Restarted the simulator viareact-native run-iosand everything works fine.Setup
react-native-cli: 2.0.1 react-native: 0.61.2 mac OSmojave 10.14.6
https://github.com/react-native-community/cli#compatibility denotes that react-native 0.61.X needs react-native-cli: 3.0.0
This solved it for me, using a managed Expo project:
expo start --ios -c
Another possible reason for this is that there are multiple versions of react-native in node_modules
Try searching for registerCallableModule('AppRegistry' in node_modules, if you find more than one, that's a likely reason
@Hugo-Meiring Probably you use modules that were removed from
react-native.
For exampleViewPagerAndroid
This was the issue for us - we jumped from RN 0.58 to RN 0.61.5 where some RN stock components were removed. ViewPagerAndroid, AsyncStorage, ListView were the culprits for us.
I face same problem just now and try any suggestion but noting change π’
when I remove my computer everywhere node_modules I resolve this issue for me!!!
(because my disk will full)
so I guess maybe are multiple versions of react-native in node_modules ?
my steps
sudo find . -name "node_modules" -type d -prune -exec rm -rf '{}' +- reinstall yarn
- run
yarnin my porject - xcode -> clean build folder
- iOS APP is working!!!!
i had the same problem, when i used react-navigation package, but i had not downloaded all the required "side-packages" (particularly is react-native-reanimated). The problem may come from one of your import. Check the guide of all packages carefully, you would definitely find a way. Good luck!!
TambΓ©m deparei com isso (configuraΓ§Γ£o abaixo). Peguei um pouco da soluΓ§Γ£o do @ m4rcoperuano e parei meu simulador e empacotador, depois removi tudo no watchman via
watchman watch-del-all. Reiniciei o simulador viareact-native run-iose tudo funciona bem.ConfiguraΓ§Γ£o
react-native-cli: 2.0.1 react-native: 0.61.2 mac OSmojave 10.14.6
it worked for me
cd ios
remove pods
pod install
worked for me
who have this problem in Android mono repo (I have not tried this with ios): as @msand mentioned the problem could be in many registerCallableModule('AppRegistry' in your result bundle. Multiple occurrences could be because of using react-native components from other monorepo packages.
So we need to remove them from the bundle:
-
react-native run-android
-
Download bundle (from http://127.0.0.1:8081/index.bundle?platform=android&dev=true&minify=false), open it and inspect for the discussing substring
-
Now we need to block node_modules loading from the found places except the first one
-
Add into metro.config.js into resolver / blacklistRE patterns like this
blacklistRE: /(.*\\component1\\node_modules\\.*|.*\\component2\\node_modules\\.*|.*\\component3\\node_modules\\.*)$/ -
start again
react-native run-android -
check bundle again, it should contain only one registerCallableModule('AppRegistry'
-
check how code works on a device.
in gap 4) you probably need to make more particular regexes if your components use "nohoist" components.
as a bonus - smaller bundle size. :)
who have this problem in Android mono repo (I have not tried this with ios): as @msand mentioned the problem could be in many registerCallableModule('AppRegistry' in your result bundle. Multiple occurrences could be because of using react-native components from other monorepo packages.
So we need to remove them from the bundle:
- react-native run-android
- Download bundle (from http://127.0.0.1:8081/index.bundle?platform=android&dev=true&minify=false), open it and inspect for the discussing substring
- Now we need to block node_modules loading from the found places except the first one
- Add into metro.config.js into resolver / blacklistRE patterns like this
blacklistRE: /(.*\\component1\\node_modules\\.*|.*\\component2\\node_modules\\.*|.*\\component3\\node_modules\\.*)$/- start again
react-native run-android- check bundle again, it should contain only one registerCallableModule('AppRegistry'
- check how code works on a device.
in gap 4) you probably need to make more particular regexes if your components use "nohoist" components.
as a bonus - smaller bundle size. :)
module.exports = {
...
resolver: {
blacklistRE: /(.*\/component\/node_modules\/.*)$/,
},
...
};
It appears that delaying the first call to AppRegistry.registerComponent() until an asynchronous event occurs is sufficient to cause this problem. I have originally run into it due to a call to fetch() but it reproduces with something as simple as the default application created by react-native init if you change
AppRegistry.registerComponent(appName, () => App);
to
setTimeout( () => AppRegistry.registerComponent(appName, () => App), 0 );
Notably, changing setTimeout() to setImmediate() in the above example made the issue go away for me.
just try yarn/npm install in your root folder of project π€
I got the same issue when I added a 3rd party library with components. The root of the problem was that the library includes react, react-native, react-navigation as direct dependencies ("dependencies" field in package.json). After moving these dependencies to "peerDependencies" field of library package.json the error gone.
Simple close the metro shell and re-run app.
Getting the same issue, in a monorepo where my redux logic lives in a shared module alongside a react-dom and react-native project ... commenting out my imports doesn't seem to change anything but the error does disappear if I comment out the redux I'm trying to render ... anyone got any clues?? As a newbie to react-native and monorepos this whole process has been a NIGHTMARE π
@lukecaan look into metro's blackList. With that you can make your app not seeing redundant libraries under redux's node_modules Ref: https://stackoverflow.com/questions/41813211/how-to-make-react-native-packager-ignore-certain-directories
I've spent a decent time figuring out what's causing this error, but still the same.
I closed the metro bundler and ran: npm start and it worked, this is weird.
It appears that delaying the first call to
AppRegistry.registerComponent()until an asynchronous event occurs is sufficient to cause this problem. I have originally run into it due to a call tofetch()but it reproduces with something as simple as the default application created byreact-native initif you change
AppRegistry.registerComponent(appName, () => App);
to
setTimeout( () => AppRegistry.registerComponent(appName, () => App), 0 );
Notably, changingsetTimeout()tosetImmediate()in the above example made the issue go away for me.
I am also a bug caused by asynchronyοΌ
I had the same issue for IOS, which appeared to pop up out of nowhere. Unfortunately, like @ralph-dev, I found the only thing that worked was going through every import statement to discover the faulty import.
It worked for me this way. Just terminated the metro and reran yarn ios.
Also try Android Studio: File > Sync Project with Gradle Files, it worked for me. π
Just run npm install then
re-run npm install -g react-native-cli , it worked for me
Why does it have to be so difficult to find out WHICH Native Module cannot be null?
Exactly....After a long frustrating period, I decided to understand what does it mean actually. As far as I understand it is trying to tell that some npm package is identified in your node modules and it's not just enough to install the package but you have to add some code in ios in order to make that package works.
In my case I have installed npm package of react-native-push-notifications and done all the required changes in android but not in IOS. my ios app which used to work fine suddenly started giving me this clueless error. Finally, I have solved it. thanks to everyone.
On iOS we followed @MaxMotovilov's suggestion about problems with delaying calling AppRegistry.registerComponent(appName, () => App). When we no longer waited for other components to load, all was good
Prev
async () => {
await analytics.setup();
AppRegistry.registerComponent(appName, () => App);
};Working
() => {
analytics.setup().catch(/* */);
AppRegistry.registerComponent(appName, () => App);
};Hi
I had this exception too. I solved my problem.
What is problem?
RN has Message Queue which tries to dynamically dispatch a message AppRegistry::runApplication. In my case Message Queue did not have key "AppRegistry" associated with object AppRegistry. App threw exception Invariant Violation: Module AppRegistry is not a registered callabel module (calling runApplication).
Why it happened?
After You import AppRegistry You have to call any method,
import { Text, AppRegistry } from 'react-native';
const App = (props) => (
<View>
<Text>App1</Text>
</View>
);
AppRegistry.registerComponent('Appname', () => App);
because it has getter which lazy loads real app registry module
get AppRegistry(): AppRegistry {
return require('./Libraries/ReactNative/AppRegistry');
},
and this module is added to to MessageQueue
BatchedBridge.registerCallableModule('AppRegistry', AppRegistry);
Why I had this problem?
I inherited some codebase with async registration of components, which did not made AppRegistry to be added to MessageQueue sooner than event AppRegistry::runApplication fired .
How did I fix this?
Since it does not matter what method of AppRegistry I call, something like this on will do
// call this as soon as possible so AppRegistry is available to RN MessageQueue
AppRegistry.registerComponent('DummyComponent', () => DummyComponent);
How would I fix this?
- I can't edit Your docs, so I can only hint: I would add to documentation that it is required to trigger loading of app registry and that it is
- I would probably add it to https://reactnative.dev/docs/appregistry , but there seems to be no Hello World code which is not aimed at Expo so I would create a Hello World page for it (You can have Hello World by running
react-native init, but it is not explained) - Or better, I would stop magically lazy loading stuff and ideally introduced init methods
Thanks
For us, the error happens because one of our components in the top-level router is not written correctly, so there are multiple errors in the log. This error happens to be the last one thus we ignored the prior error. We found this out by reading the entire log from bottom to top.
Try:
- unlink the packages you've done manually
- cd ios && rm -rf Pods && pod cache clean --all && pod install && cd .. (@djohnsonkc)
- close the metro shell and re-run app. (@alitele)
i had the same problem, when i used react-navigation package, but i had not downloaded all the required "side-packages" (particularly is react-native-reanimated). The problem may come from one of your import. Check the guide of all packages carefully, you would definitely find a way. Good luck!!
hello let's be friends! Could you please give me your facebook profile!
@hcminhit not cool man
Upgrating from react-native:"0.62.2" to "0.63.1" give me this error.
For me it's imposible to upgrade react-native without getting an error. It's amazing..
I had to close metro and run expo start again. And it worked.
you sure have probleme in an import that was not installed correct or that you have to reinstall your node modules
I've had this issue multiple times and in every one of them I used a different solution. I always come here, like a retard, see that it's a vague error and end up just digging around my code and ultimately finding something dumb that I've done that broke my app. This last time, I had literally no idea what could be wrong. So I just ran pod install and npm install. Restarted the server, rebuilt the projects and it worked... MAGIC!
I've had this problem when one of the dependencies was specified incorrectly and it led to two instances of react-native being installed in node_modules
I'm updating a quite large project from 0.61 to 0.63 and I'm running into this issue.
I've extracted from our code all the imports we do from react-native:
require("react-native").View;
require("react-native").StyleSheet;
require("react-native").PixelRatio;
require("react-native").Dimensions;
require("react-native").Text;
require("react-native").Image;
require("react-native").TouchableOpacity;
require("react-native").KeyboardAvoidingView;
require("react-native").ScrollView;
require("react-native").TouchableWithoutFeedback;
require("react-native").Modal;
require("react-native").Switch;
require("react-native").FlatList;
require("react-native").ToastAndroid;
require("react-native").Alert;
require("react-native").NativeEventEmitter;
require("react-native").AppState;
require("react-native").ActivityIndicator;
require("react-native").ProgressBarAndroid;
require("react-native").RefreshControl;
require("react-native").Linking;
require("react-native").TouchableHighlight;
require("react-native").Share;
require("react-native").Animated.View;
require("react-native").Animated;
require("react-native").Animated.Value;
require("react-native").BackHandler;
require("react-native").Keyboard;
require("react-native").Vibration;
require("react-native").ImageBackground;
require("react-native").SafeAreaView;
require("react-native").Slider;
require("react-native").TextInput;
Do you see any of them that would cause this error?
If it's not there, then it is perhaps on the other react-native modules sigh...
I'm updating a quite large project from 0.61 to 0.63 and I'm running into this issue.
I've extracted from our code all the imports we do from
react-native:require("react-native").View; require("react-native").StyleSheet; require("react-native").PixelRatio; require("react-native").Dimensions; require("react-native").Text; require("react-native").Image; require("react-native").TouchableOpacity; require("react-native").KeyboardAvoidingView; require("react-native").ScrollView; require("react-native").TouchableWithoutFeedback; require("react-native").Modal; require("react-native").Switch; require("react-native").FlatList; require("react-native").ToastAndroid; require("react-native").Alert; require("react-native").NativeEventEmitter; require("react-native").AppState; require("react-native").ActivityIndicator; require("react-native").ProgressBarAndroid; require("react-native").RefreshControl; require("react-native").Linking; require("react-native").TouchableHighlight; require("react-native").Share; require("react-native").Animated.View; require("react-native").Animated; require("react-native").Animated.Value; require("react-native").BackHandler; require("react-native").Keyboard; require("react-native").Vibration; require("react-native").ImageBackground; require("react-native").SafeAreaView; require("react-native").Slider; require("react-native").TextInput;Do you see any of them that would cause this error?
If it's not there, then it is perhaps on the other react-native modules sigh...
It is probably race condition.
Add some code which imports AppRegistry and calls any of AppRegistry methods (Why? Because when some method of AppRegistry is called, AppRegistry is loaded and initialized).
Then please tell us if Your problem was fixed.
@marcofuentes05 you are not having the same issue... In your case, just restart the metro bundler and you'll be OK...
It is probably race condition.
Add some code which imports AppRegistry and calls
anyof AppRegistry methods (Why? Because when some method of AppRegistry is called, AppRegistry is loaded and initialized).Then please tell us if Your problem was fixed.
@xchmelmilos you were right. I've added this:
import {AppRegistry} from 'react-native';
console.log('getAppKeys()=',AppRegistry.getAppKeys());At the very beginning of my index.js file and the error is gone...
I'm a bit puzzled here:
-> I did not need to do that with RN 0.61.
-> I do not use AppRegistry directly as I am using react-native-navigation...
So I guess I should now try to identify which call where causing this race condition right?
With react native navigation alone, I do not get this error. So there is something in our code that get executed before RNN and after startup, that causes it...
If you have any hint/suggestion on how to proceed faster and more reliably to find it, please do not hesitate to tell me...
Once again thanks for your help @xchmelmilos!
Edit: for anyone using RNN, there is this issue there which is related.
It is probably race condition.
Add some code which imports AppRegistry and callsanyof AppRegistry methods (Why? Because when some method of AppRegistry is called, AppRegistry is loaded and initialized).
Then please tell us if Your problem was fixed.@xchmelmilos you were right. I've added this:
import {AppRegistry} from 'react-native'; console.log('getAppKeys()=',AppRegistry.getAppKeys());At the very beginning of my
index.jsfile and the error is gone...I'm a bit puzzled here:
-> I did not need to do that with RN 0.61.
-> I do not useAppRegistrydirectly as I am using react-native-navigation...So I guess I should now try to identify which call where causing this race condition right?
With react native navigation alone, I do not get this error. So there is something in our code that get executed before RNN and after startup, that causes it...
If you have any hint/suggestion on how to proceed faster and more reliably to find it, please do not hesitate to tell me...
Once again thanks for your help @xchmelmilos!
Edit: for anyone using RNN, there is this issue there which is related.
It is caused by RN itself, You just have to be faster to initialize this than RN internal message queue tries to access it - I wrote about it here #26687 (comment) .
@xchmelmilos actually, I thought the error was gone but it is not. I'm still seeing it in my logcat logs... Even with the addition to the index.js file I've made.
I'm a bit clueless on this one...
It is a bit of black magic in my opinion because here what I exactly observe:
-> Without the index.js hotfix (pre-loading AppRegistry as you'b-ve suggested), I see the error both in logcat and in the RN logbox (dev mode):
2020-07-30 17:00:38.083 31128-31620/my.app I/ReactNativeJS: AppNavigation.hx:75: AppNavigation.init()
2020-07-30 17:00:38.156 31128-31620/my.app I/ReactNativeJS: AppNavigation.hx:233: setNavigationStack
2020-07-30 17:00:38.190 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance()
2020-07-30 17:00:38.191 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication
2020-07-30 17:00:38.193 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance()
2020-07-30 17:00:38.193 31128-31620/my.app I/ReactNativeJS: Running "Home" with {"initialProps":{"componentId":"Component5"},"rootTag":111}
2020-07-30 17:00:38.193 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication
2020-07-30 17:00:38.217 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance()
2020-07-30 17:00:38.218 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication
2020-07-30 17:00:38.983 31128-31620/my.app I/ReactNativeJS: Running "SideMenu" with {"initialProps":{"componentId":"drawer-id"},"rootTag":121}
-> With the fix, I see it only in logcat (not in logbox anymore):
2020-07-30 17:04:13.591 31128-31832/my.app I/ReactNativeJS: AppNavigation.hx:75: AppNavigation.init()
2020-07-30 17:04:13.625 31128-31832/my.app I/ReactNativeJS: AppNavigation.hx:233: setNavigationStack
2020-07-30 17:04:13.643 782-31866/? E/ResolverController: No valid NAT64 prefix (244, <unspecified>/0)
2020-07-30 17:04:13.664 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance()
2020-07-30 17:04:13.665 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication
2020-07-30 17:04:13.666 31128-31832/my.app I/ReactNativeJS: Running "Home" with {"initialProps":{"componentId":"Component5"},"rootTag":151}
2020-07-30 17:04:13.667 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance()
2020-07-30 17:04:13.668 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication
2020-07-30 17:04:13.689 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance()
2020-07-30 17:04:13.690 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication
2020-07-30 17:04:14.164 31128-31832/my.app I/ReactNativeJS: Running "SideMenu" with {"initialProps":{"componentId":"drawer-id"},"rootTag":161}
I do not see any significant difference in the logcat output :(...
It is a bit of black magic in my opinion because here what I exactly observe:
-> Without the index.js hotfix (pre-loading AppRegistry as you'b-ve suggested), I see the error both in logcat and in the RN logbox (dev mode):
2020-07-30 17:00:38.083 31128-31620/my.app I/ReactNativeJS: AppNavigation.hx:75: AppNavigation.init() 2020-07-30 17:00:38.156 31128-31620/my.app I/ReactNativeJS: AppNavigation.hx:233: setNavigationStack 2020-07-30 17:00:38.190 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance() 2020-07-30 17:00:38.191 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication 2020-07-30 17:00:38.193 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance() 2020-07-30 17:00:38.193 31128-31620/my.app I/ReactNativeJS: Running "Home" with {"initialProps":{"componentId":"Component5"},"rootTag":111} 2020-07-30 17:00:38.193 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication 2020-07-30 17:00:38.217 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance() 2020-07-30 17:00:38.218 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication 2020-07-30 17:00:38.983 31128-31620/my.app I/ReactNativeJS: Running "SideMenu" with {"initialProps":{"componentId":"drawer-id"},"rootTag":121}-> With the fix, I see it only in logcat (not in logbox anymore):
2020-07-30 17:04:13.591 31128-31832/my.app I/ReactNativeJS: AppNavigation.hx:75: AppNavigation.init() 2020-07-30 17:04:13.625 31128-31832/my.app I/ReactNativeJS: AppNavigation.hx:233: setNavigationStack 2020-07-30 17:04:13.643 782-31866/? E/ResolverController: No valid NAT64 prefix (244, <unspecified>/0) 2020-07-30 17:04:13.664 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance() 2020-07-30 17:04:13.665 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication 2020-07-30 17:04:13.666 31128-31832/my.app I/ReactNativeJS: Running "Home" with {"initialProps":{"componentId":"Component5"},"rootTag":151} 2020-07-30 17:04:13.667 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance() 2020-07-30 17:04:13.668 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication 2020-07-30 17:04:13.689 31128-31128/my.app E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance() 2020-07-30 17:04:13.690 31128-31128/my.app E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication 2020-07-30 17:04:14.164 31128-31832/my.app I/ReactNativeJS: Running "SideMenu" with {"initialProps":{"componentId":"drawer-id"},"rootTag":161}I do not see any significant difference in the logcat output :(...
I do not see any errors in your listing, I see only information that AppRegistry.runApplication was called - which is ok. Have You pasted correct listings?
@xchmelmilos excuse me you are right again, the following error log appears without preloading AppRegistry:
2020-07-31 08:48:10.091 1874-2153/my.app E/ReactNativeJS: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication), js engine: hermes
I was mistaken because ReactRootView: runApplication: call AppRegistry.runApplication is a E error log and I was interpreting it as an error while it is probably not one.
So all is good, you hotfix works indeed. But shouldn't it be fixed right within RN?
Got similar to @zabojad problem. After implementing a fix suggested, got this:
ExceptionsManager.js:179 Invariant Violation: "NavBarTextButton" 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.
Not ideal, but leads me to a direction which component may actually cause a problem.
Edit:
Finally fixed it. For me it was an order in which appState.registerComponent was called. For some reason, after reloading, Navigation.events().registerAppLaunchedListener was called after MessageQueue call.
Put components registration code first thing in index.js and error has gone.
This
import {AppRegistry} from 'react-native';
console.log('getAppKeys()=',AppRegistry.getAppKeys());allowed me to find a core problem, so give it a try. It may work for you.
React Native: 0.63.1
RNN: 6.6.0-snapshot.989
@xchmelmilos excuse me you are right again, the following error log appears without preloading AppRegistry:
2020-07-31 08:48:10.091 1874-2153/my.app E/ReactNativeJS: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication), js engine: hermesI was mistaken because
ReactRootView: runApplication: call AppRegistry.runApplicationis aEerror log and I was interpreting it as an error while it is probably not one.So all is good, you hotfix works indeed. But shouldn't it be fixed right within RN?
Yes, this magical lazy loading of AppRegistry is nonsense, it should be explicit call like initializeAppRegistry() or initializing AppRegistry immediately when import is called.
For my case I had to upgrade react-native-progress.
oblador/react-native-progress#201 (comment)
Even after using the AppRegistry lazy-loading workaround it doesn't work for me.
It seems to crash when using react-navigation's createStackNavigator and other such methods.
Just upgraded from RN 0.61.5 to 0.63.2, had no issues before.
Fixed the issue on my end by double checking that i modified all the files correctly during my RN upgrade, then running
watchman watch-del-all, andreact-native start --reset-cache. Then on android, build -> clean. then it worked! sigh
That worked for me.
Thanks
I am also facing issue with React Navigation with reference to stack other methods. Mine is new project it was working yesterday suddenly stopper tried all the above mentioned steps but nothing worked for me.
RN info -
System:
OS: macOS 10.15.3
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 86.23 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.18.2 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.14.5 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6241897
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native: 0.61.5
In our case, there was a bug in a function that was being called at the global level in a module, i.e., at module load time. We had something like this in foo.js:
export default (a, { param }) => {
...
and then in bar.js we had something like this:
import foo from './foo.js'
foo('something')
i.e., called foo() at the top level of the module but without the final argument. I doubt it was specific to this particular bug, but the crash at module load time was probably enough to derail the AppRegistry.
Ok guys, here we are my solution for this issue:
- npm install native-base@latest -g
- npm install react-native@latest -g
- change package.json for these dependencies
- delete node_modules and npm install
Open it Xcode and Build/Run from scratch
I hope it helped
Probably the single most vague, annoying error in the react-native environment... And we know there's a lot of them :)
Usually I'm getting it after adding a package via yarn add. Not sure if it's connected to yarn itself and whether npm fixes it. In my case the fix is to remove node_modules and reinstall them, but then again... it's after every package add/remove I do, which can be very annoying and time consuming.
I spent a few hours having the same issue Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication) and it happened "from nowhere".
Because everything was working fine in the previous day and everything was still working fine in the production bundle I thought the usual YOLO commands delete, clean and re-install everything would fix it but I was wrong.
Turns out it was one of the imports (as some suggested above). I couldn't believe it because this package/import has been in the project for weeks π€
Like @weblancaster, I've recieved this error from nothing. Some days ago I had a good-working app, but suddenly this error appeared, though I didn't install any modules or changed anything. I've tried to reinstall node modules, clean cache, re-link libraries but nothing helped.
@amphyxs take a look at your imports or any small bug that could have been introduced in the past days. Turns out the error message is pretty vague and could be anything but the actual AppRegistry call.
I was having this issue on iOS and not Android. This made me think it was likely a bad module install for the iOS platform. After some debugging I found out it was react-native-unimodules. I had set it up badly setup on iOS.
Now that in itself may be useful, but likely not. I'd like to share my approach, as that is more useful.
-
Start in
App.tsxand start cutting components/children out one by one until it builds something successfully.
(I placed a dummy<View>with a<Text>so I knew when it was successful.) -
Once its loaded - add the offending component/line back in, and let FastRefresh reload your app.
-
In my case - and I hope in your case too - the error will now be different! This is because the initial App registration was complete, and FastRefresh must work a different way.
-
Look at the error - hopefully it's useful! (Mine mentioned
unimodules- aha!)
That made then finding the issue a lot lot simpler.
Best of luck! π€πΌ
Downgraded back from 0.63.2 to 0.61.5.....fixed the problem.
Hopefully RN team will address this with next release and then Ill upgrade again
I found that I had a small piece of styling that was missing a letter, and that caused this error to pop up. I had "alignConten" instead of "alignContent", and just adding that 't' fixed the error. I sincerely hope everyone was having different, and more relevant issues underlying their errors...
Encountered this issue after upgrading to 0.63.2, commenting out the imports did eventually help as I was able to see some additional error logs. I had 3 libraries giving me issues.
"react-native-paper": "^4.1.0", // forced to update from 2.15.2
"react-navigation-material-bottom-tabs": "^2.3.0", // forced to update from 1.0.0
"react-native-material-textfield": applied this patch https://stackoverflow.com/a/62794092/12843101
Check if you don't have this situation:
/folder/index.js
export * from './a'
export * from './b'/folder/a
export function a(){
//...
}/folder/b
export function a(){ //instead of b()
//...
}When trying to import the modules exported with the same name, it gives this error.
Apparently I started getting this error after an unsuccessful npm installation of css-to-react-native
Edite: Restarting all programs does solve the issue but don't know the root of the problem.
I really don't know how to explain, but for me, when this happens, I just close everything (Visual Studio, Android Studio, Emulators) and reopen them. After that, my app starts to work again. ItΒ΄s very weird but I got this Module AppRegistry error many times and every time I restarted all the programs, my app "came back to life". It doesn't hurt to try!
Close everything: Server, VS Code, Emulator, Rebuild the by --reset-cache command, and run your app. If still persists, try restarting the system and doing the steps once more.
I reverted to react-native 0.62.0 from 0.63.2. At least 0.62.0 shows some information that which component has the problem. Then I able to fix the issue related to the component. Hopes in the future update we will get more information about the issue in the log.
For ios i've only intalled pod, the command i recommend is:
cd ios; pod install; cd ..
I consider that this is produced when i installed react-navigation on my node_modules, and then i forgot to install the pod files related to this new dependency.
Then hit on clear build, close and open xcode and run
In case this helps... I resolved this on Android by manually registering some ReactPackage's, despite the instructions of ReactNative and ReactNative-Firebase against that ( https://rnfirebase.io/migrating-to-v6 )
I added:
.addPackage(new ReactNativeFirebaseAppPackage())
.addPackage(new ReactNativeFirebaseCrashlyticsPackage())
It may be relevant that I also register other packages manually - like MainReactPackage, but also MyAppReactPackage, RNRecyclerviewListPackage etc. No idea if the extra ones are compliant with auto-linking or whatever else.
My dependencies are:
"@react-native-firebase/app": "^8.4.5",
"@react-native-firebase/crashlytics": "^8.4.9",
"react": "16.9.0",
"react-native": "0.61.5",
(gradle)
val firebase = "17.5.0"
crashlytics = "17.2.2"
crashlyticsPlugin = "2.3.0"
P.S. It's probably a stupid way to solve the problem, and I probably have lots of inconsistencies in my setup. At some point it's just trial and error now...
for me expo r -c cleared cache then restart the application worked perfectly for me
So I have been roped back into this project because the issue was resurfaced again. The initial issue was eventually resolved by:
- Creating a new react native project from scratch with the exact same name but the latest version (and git init it + commit). This is useful to see what changes between the latest init project that attempts to copy parts of the broken one.
- Slowly add all the libraries to the package.json and keep testing which broke and which didn't, using the latest of each where possible. And get it to just show the default hello world screen without issue with all the libraries.
- Add all the source code and update all breaking changes + refactor where needed. I did it first for the inner react native project, and then once it worked did it for our main project. This eventually allowed both iOS and Android to run 0.61.X
- Copy over this working project over the broken project (remember don't copy over / delete the .git folder of either project). Commit and you are good to go.
I love @ralph-dev 's fastest way suggestion and agree. We will take that route first. That should work, then we can update to react native 0.63.x. Else we will need to do the above like previously. Will report back. All the other suggestions have been tried by the dev that took over from me.
Final note, to those that find this. Especially with some very complex issues, ones where the compilers fail because of a compiler bug, no output or stack trace is given or the crash is not even in any code remotely related or identifiable to you, where Google has no results (not even in Chinese, google translate is amazing and has helped immensely) and there is no smart strategy the way I found to solve the issue as last resort is a binary search. Keeping dividing your code into half (not literally) and disable the one "half". Keep doing this until you hit the issue. It grows exponentially and you will soon get to the issue within 8 - 20 levels deep.
I solved this problem by removing a dependency and an instance that I had made, but I forgot to remove these 2 lines of code
this error occurs when you add dependency without linking it with react-native link, to fix this you need to remove the dependency, reinstall it and link it with react-native link
(there are only certain dependencies that must be linked)
I ran into this issue when updating to RN 0.63.3, we figured out it was because we were importing a library which had a dependency on an older version of react, hence two react native versions were being loaded into the yarn lockfile.
Could be something for you guys to check out - take a look at the lockfile and ensure there's only one version of react native in there.
I had the same problem when updating to RN 0.63.3.
And it work for me by adding the code
"resolutions": {
"@react-native-community/viewpager": "4.1.0",
"react-native-webview": "10.10.0",
}
I had the same problem when updating to RN 0.63.3.
And it work for me by adding the code
"resolutions": {
"@react-native-community/viewpager": "4.1.0",
"react-native-webview": "10.10.0",
}
Where can I use this code?
I had the same problem when updating to RN 0.63.3.
And it work for me by adding the code
"resolutions": {
"@react-native-community/viewpager": "4.1.0",
"react-native-webview": "10.10.0",
}Where can I use this code?
package.json
As commented before, it's quite a generic error.
Remove the node_modules folder and then run yarn install or npm install
it seemed to solve the issue here.
Another possible reason for this is that there are multiple versions of react-native in node_modules
thank for insight




