Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invariant Violation: Module AppRegistry is not a registered callabel module (calling runApplication) #26687

Closed
Hugo-Meiring opened this issue Oct 2, 2019 · 158 comments
Labels
API: AppRegistry Bug Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Hugo-Meiring
Copy link

Screenshot 2019-10-02 at 13 35 27

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

  1. Update the package.json values to use latest 0.61.1 (and other latest values pulled for a react-native init)
  2. 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.

@radko93
Copy link
Contributor

radko93 commented Oct 2, 2019

Unfortunately, this error does not give any feedback on what exactly is wrong. You need to dig deeper.

@Hugo-Meiring
Copy link
Author

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]'```

@Hugo-Meiring
Copy link
Author

Here is are whats if your re-run the app:

Screenshot 2019-10-02 at 14 26 26

@radko93
Copy link
Contributor

radko93 commented Oct 2, 2019

Did you try to enable the Debug option?

@Hugo-Meiring
Copy link
Author

Screenshot 2019-10-02 at 14 30 27

@m4rcoperuano
Copy link

Getting this same issue but only on Android. Very weird :(

@Hugo-Meiring
Copy link
Author

Did you try to enable the Debug option?

Yes, I also tried toggling Fast Refresh off.

@m4rcoperuano
Copy link

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

@Hugo-Meiring
Copy link
Author

Unfortunately, it doesn't work our project (iOS) @m4rcoperuano. Glad it worked for you

@radko93
Copy link
Contributor

radko93 commented Oct 3, 2019

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.

@asielykey
Copy link

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

yeah me too,
react-native start --reset-cache
worked on my case

@Hugo-Meiring
Copy link
Author

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.

@eXist-FraGGer
Copy link

eXist-FraGGer commented Oct 7, 2019

@Hugo-Meiring Probably you use modules that were removed from react-native.
For example ViewPagerAndroid

@Hugo-Meiring
Copy link
Author

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.

@gaguirre
Copy link

gaguirre commented Oct 9, 2019

@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.

@ra0x3
Copy link

ra0x3 commented Oct 10, 2019

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

@djohnsonkc
Copy link

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.

@ralph-dev
Copy link

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!

@schumannd
Copy link

schumannd commented Nov 12, 2019

Why does it have to be so difficult to find out WHICH Native Module cannot be null?

@kalmahik
Copy link

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(

@AdrianMrn
Copy link

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.

@sankar2389
Copy link

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

https://github.com/react-native-community/cli#compatibility denotes that react-native 0.61.X needs react-native-cli: 3.0.0

@nandorojo
Copy link

This solved it for me, using a managed Expo project:

expo start --ios -c

@msand
Copy link
Contributor

msand commented Jan 14, 2020

Another possible reason for this is that there are multiple versions of react-native in node_modules

@msand
Copy link
Contributor

msand commented Jan 14, 2020

Try searching for registerCallableModule('AppRegistry' in node_modules, if you find more than one, that's a likely reason

@tnortman
Copy link

tnortman commented Jan 15, 2020

@Hugo-Meiring Probably you use modules that were removed from react-native.
For example ViewPagerAndroid

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.

@niclin
Copy link

niclin commented Jan 19, 2020

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

  1. sudo find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
  2. reinstall yarn
  3. run yarn in my porject
  4. xcode -> clean build folder
  5. iOS APP is working!!!!

@tahaphuong
Copy link

tahaphuong commented Jan 29, 2020

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!!

@pedrobneto
Copy link

Just spent a couple hours trying to figure this out, tried everything, and turns out it was because I was calling Stylesheet without importing it in one file...

@amirhosseinkabiri
Copy link

I hade the Same Issue but the problem was because I had the colors in a separated folder and in one of components I refers to a non-existing color... . But it didn't say where exactly the problem is! Hope it helps you...

@naolworku
Copy link

naolworku commented Oct 13, 2021

If you tried all options given and not working, the issue is with the Drawer navigator
Sometimes this will fix it
npm install --save @babel/runtime

@naolworku
Copy link

naolworku commented Oct 27, 2021 via email

@nhattuongvippro123
Copy link

I solved this issue just by adding

import { AppRegistry } from "react-native";
import App from "./App";
import { name as appName } from "./app.json";
AppRegistry.registerComponent(appName, () => App);

to my index.js
it works for this issue. 14/11/2021

@harshan89
Copy link

I think there is no solution for this, for me it worked after reinstalling and clearing caches several times,

My steps was,

removed node_module
removed Pods folder in ios

  1. go to root folder
  2. yarn install
  3. cd ios && pod install
  4. cd ..
  5. react-native start --reset-cache

repeated several time suddenly it worked. 😕

@hirajgajera
Copy link

BUNDLE ./index.js

ERROR Error: Cannot create styled-component for component: undefined.

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.

Already tried:

  1. gradlew clean.
  2. deleted node_modules and reinstalled it.
  3. styled component works perfectly in similar app in similar environment
  4. index.js file corrected and is as below:

/**

import { AppRegistry } from "react-native";
import App from "./App";
import { name as appName } from "./app.json";
AppRegistry.registerComponent(appName, () => App);

No solution found on stackoverflow!

@25308985
Copy link

For me, the issue was my application package name. Actually, I was reusing the source code of the existing app to make a replica of the same app. So I kept the "build_config_package" the same as an old app but changes the package name.

@jamalumusic
Copy link

1- update your react-native-reanimated library to "react-native-reanimated": "2.0.0"

2- You should update the babel.config.json file and add react-native-reanimated/plugin to plugins
3- run this command react-native start --reset-cache

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    "react-native-reanimated/plugin",
  ],
};

This will fix your issue

@mwalkerr
Copy link

Well this was pretty dumb in my case. We're using React Native Brownfield and I made an update to add a new package:

 val packages = PackageList(this)
        .packages
        .toMutableList()
        .add(MyRNPackage())
            

Well add returns a boolean, not a reference to the list, so the list of packages being sent to react native brownfield was actually just a boolean...

@ZubairovSalim
Copy link

Facing same problem on ios, after deleting com.facebook.react.BuildConfig from MainApplication.java for solving this bug on android #29396. Helped for me: Go to Xcode -> Product -> Clean Build Folder. Rebuild and run.

@AndriyZahura
Copy link

AndriyZahura commented Jan 26, 2022

For me the fix was to comment the most recent style files I've worked on, and uncomment them one by one.

@Shah-zaib44
Copy link

Just spent a couple hours trying to figure this out, tried everything, and turns out it was because I was calling Stylesheet without importing it in one file...

your comment really helped me

@isaacparsons-dw
Copy link

isaacparsons-dw commented Feb 22, 2022

I have been having this issue on and off. What I have found most reliable is to delete and reinstall pods. This error message has also shown up on my end when running a different application in xcode than what metro is running. Happens when I forget to kill metro when switching projects whilst having two instances of xcode open.

@guisantosalves
Copy link

I solved this issue, I tried to rebuild my app with a new lib that I installed, but it was bugging my app, then I delete the app in my VM (virtual machine) and I remove some dependecies that I've inserted manually, the files that I change were: android\settings.grandle and \android\app\src\main\java\com<nameProject>\MainApplication.java.

I run
npx react-native start
and
npx react-native run-android

it's work :)

@sabrimev
Copy link

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.

  1. There might be a missing import.
  2. There might be a missing configuration with the library you recently installed.
  3. You may not receive errors in Android but in IOS. Then one of the lib configurations in IOS is missing.
  4. 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.

@leonardoMoliveira
Copy link

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!

Best solution 🥳 , I was investigating by eliminating imports from my index.js, until I found the problem. Thanks!

@kohana11
Copy link

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!

In time to find out what's wrong or your task is blocked, this maybe the best solution to try.

@timothybowers
Copy link

For me this helped me find the problem, to which file was causing the error. (Root cause)

I made sure my metro.config.js file contained this line:
inlineRequires: true,

@margox
Copy link

margox commented Nov 20, 2022

For anyone else who facing the same issue and cannot resolve it with every solution you found on the internet, maybe you shoud check if there is a node_module folder inside your src or components folder.
It wasted me half a day and I finally found the reason: I executed npm i inside in a deeper path of my project , Holy shit..

@eitan123a
Copy link

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!

Bro, I don't know you but you saved me after 3 days of pulling my hair out!!
You're my savior!!

@justintoth
Copy link

In case it helps others... None of the answers above worked for me. I cleaned my iOS pods, npm packages, etc... and also verified that all of my 3rd party package and internal component imports were correct, and was still receiving the error. After two hours, I finally tried quitting the app, uninstalling it, quitting metro, restarting it, then reinstalling the app and it worked! I believe the crucial step was restarting metro...

@salorsino
Copy link

Seeing this now on a RN app with multiple devs - had one teammate with this issue b/c he was running npm install --legacy-peer-deps due to still using deprecated @react-native-community/async-storage. Had him update to @react-native-async-storage/async-storage and his issues were fixed, but then it started for me...

Still struggling with this issue as of now on my own machine after trying all the above solutions

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 19, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: AppRegistry Bug Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests