react-native icon indicating copy to clipboard operation
react-native copied to clipboard

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

Open Hugo-Meiring opened this issue 6 years ago • 154 comments

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.

Hugo-Meiring avatar Oct 02 '19 11:10 Hugo-Meiring

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

radko93 avatar Oct 02 '19 12:10 radko93

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 avatar Oct 02 '19 12:10 Hugo-Meiring

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

Screenshot 2019-10-02 at 14 26 26

Hugo-Meiring avatar Oct 02 '19 12:10 Hugo-Meiring

Did you try to enable the Debug option?

radko93 avatar Oct 02 '19 12:10 radko93

Screenshot 2019-10-02 at 14 30 27

Hugo-Meiring avatar Oct 02 '19 12:10 Hugo-Meiring

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

m4rcoperuano avatar Oct 02 '19 13:10 m4rcoperuano

Did you try to enable the Debug option?

Yes, I also tried toggling Fast Refresh off.

Hugo-Meiring avatar Oct 02 '19 13:10 Hugo-Meiring

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

m4rcoperuano avatar Oct 02 '19 13:10 m4rcoperuano

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

Hugo-Meiring avatar Oct 03 '19 08:10 Hugo-Meiring

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.

radko93 avatar Oct 03 '19 09:10 radko93

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

asielykey avatar Oct 03 '19 09:10 asielykey

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 avatar Oct 03 '19 10:10 Hugo-Meiring

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

eXist-FraGGer avatar Oct 07 '19 19:10 eXist-FraGGer

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 avatar Oct 08 '19 12:10 Hugo-Meiring

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

gaguirre avatar Oct 09 '19 21:10 gaguirre

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

ra0x3 avatar Oct 10 '19 02:10 ra0x3

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.

djohnsonkc avatar Oct 15 '19 16:10 djohnsonkc

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!

ralph-dev avatar Oct 20 '19 04:10 ralph-dev

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

schumannd avatar Nov 12 '19 15:11 schumannd

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(

kalmahik avatar Nov 13 '19 11:11 kalmahik

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.

AdrianMrn avatar Nov 13 '19 12:11 AdrianMrn

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

sankar2389 avatar Dec 17 '19 07:12 sankar2389

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

expo start --ios -c

nandorojo avatar Jan 10 '20 00:01 nandorojo

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

msand avatar Jan 14 '20 20:01 msand

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

msand avatar Jan 14 '20 20:01 msand

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

tnortman avatar Jan 15 '20 21:01 tnortman

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

niclin avatar Jan 19 '20 10:01 niclin

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

tahaphuong avatar Jan 29 '20 15:01 tahaphuong

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 via react-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

thiagodevvv avatar Feb 15 '20 13:02 thiagodevvv

cd ios remove pods pod install worked for me

henriquecorraro avatar Feb 19 '20 17:02 henriquecorraro