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

improve "not a registered callable module" error message #28913

Closed
wants to merge 2 commits into from

Conversation

vonovak
Copy link
Collaborator

@vonovak vonovak commented May 17, 2020

Summary

Motivation:

Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). is an error that happens rarely, and most SO answers end up recommending to use react-native bundle to work around. I stumbled upon this error the other day and it took me a while to figure out that the error was caused by the fact that my entryFile path was pointing to an existing but invalid file. I figured it would be nice to mention this because I believe this will be a frequent cause of the error.

Changelog

[General] [Changed] - improve "not a registered callable module error message"

Test Plan

tested locally with RNTester, prints

[Sun May 17 2020 18:15:55.396]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). This can happen when the application entry file path is incorrect.
      On Android, verify 'getJSMainModuleName()' in 'MainApplication.java' and 'project.ext.react.entryFile' in 'android/app/build.gradle'.
      On iOS, verify '- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge' in 'AppDelegate.m' and 'ENTRY_FILE' env. variable passed to 'react-native-xcode.sh' (if any) in 'Build Phases' -> 'Bundle React Native code and images'.

in metro logs

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 17, 2020
@vonovak vonovak changed the title improve not a registered callable module error message improve "not a registered callable module" error message May 17, 2020
@analysis-bot
Copy link

analysis-bot commented May 17, 2020

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 46d6e7f

@analysis-bot
Copy link

analysis-bot commented May 17, 2020

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 6,782,171 21,003
android hermes armeabi-v7a 6,446,338 22,212
android hermes x86 7,169,249 20,435
android hermes x86_64 7,060,562 21,835
android jsc arm64-v8a 8,949,937 17,086
android jsc armeabi-v7a 8,606,518 18,340
android jsc x86 8,780,138 16,529
android jsc x86_64 9,357,098 17,952

Base commit: 46d6e7f

@vonovak
Copy link
Collaborator Author

vonovak commented Jul 9, 2020

hello, @fkgozali I heard you might be the right person to review, would you mind taking a look at this? Thank you in advance! :)

method,
`Module ${module} is not a registered callable module (calling ${method}). This can happen when the application entry file path is incorrect.
On Android, verify 'getJSMainModuleName()' in 'MainApplication.java' and 'project.ext.react.entryFile' in 'android/app/build.gradle'.
On iOS, verify '- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge' in 'AppDelegate.m' and 'ENTRY_FILE' env. variable passed to 'react-native-xcode.sh' (if any) in 'Build Phases' -> 'Bundle React Native code and images'.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message for Android/iOS here assumes specific usage of a build system, which is not always the case (e.g. some uses BUCK to build). I'd just remove them, or provide url to a section in the https://reactnative.dev/ with platform specific instructions.

This can happen when the application entry file path is incorrect.

Note that this is not the only reasons this error happens, some times a bad JS bundle, or an early initialization error when loading React Native will cause this error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fkgozali I updated the message, please let me know if this is ok or not. Thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fkgozali hello again, would you please share your thoughts on this? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, I'm merging this.

@vonovak vonovak force-pushed the improve-bundle-error branch from 590987f to 8944a26 Compare July 11, 2020 09:19
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fkgozali has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @vonovak in e27d656.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Aug 14, 2020
philippeauriach pushed a commit to philippeauriach/react-native that referenced this pull request May 5, 2021
)

Summary:
Motivation:

`Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication).` is an error that happens rarely, and most SO answers end up recommending to use `react-native bundle` to work around. I stumbled upon this error the other day and it took me a while to figure out that the error was caused by the fact that my `entryFile` path was pointing to an existing but invalid file. I figured it would be nice to mention this because I believe this will be a frequent cause of the error.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Changed] - improve "not a registered callable module error message"

Pull Request resolved: facebook#28913

Test Plan:
tested locally with RNTester, prints

```
[Sun May 17 2020 18:15:55.396]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). This can happen when the application entry file path is incorrect.
      On Android, verify 'getJSMainModuleName()' in 'MainApplication.java' and 'project.ext.react.entryFile' in 'android/app/build.gradle'.
      On iOS, verify '- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge' in 'AppDelegate.m' and 'ENTRY_FILE' env. variable passed to 'react-native-xcode.sh' (if any) in 'Build Phases' -> 'Bundle React Native code and images'.
```

in metro logs

Reviewed By: mdvacca

Differential Revision: D23107228

Pulled By: fkgozali

fbshipit-source-id: 0712ed7e593ba96b041578bafdbefcd09a3994b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants