-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
RN 0.60.5 app on iOS crashes on startup: "RCTFatalException: Unhandled JS Exception: Native module cannot be null" #26119
Comments
@sunweiyang I have this same problem, any luck? |
@sunweiyang the same issue, I'll downgrade to RN lower version and see if there is any luck
|
@ckOfor No luck yet. |
yes seems like it's different I'll open a new bug, Thank you!! |
@sunweiyang :( Mine too crashes after splash screen |
Have the same issue |
Have same issue |
Any news here? |
@sunweiyang I finally found a fix for mine which was similar to yours
Add this to the bottom of your entry file
|
However, mine was App is not registered so I guess yours has something to do with AppRegistry |
@ckOfor Glad to see that you got yours to work! I do have that line in my entry file, so unfortunately I'm still stuck. |
@oknechirik @emision @deepslam I'm curious, are any of you also using CodePush? Wondering if it's related. |
Not using it and I've got the very same issue than yours. Fine on Android, crash on iOS |
I fixed it. I had the error du to react-native-reanimated. I linked it with react-native link. Then I got the same error but on another module. EDIT: I confirm that it works after setting CocoaPods up! Copy the Podfile from the upgrade link above. then you this quick guide. And open and build from your [project_name].xcworkspace and you should be good to go! |
@sunweiyang can you share your pod file? |
I finally got mine working by
|
For linking RNScreen manually
|
All right, I have made a small step in the right direction. I was using I've made the following changes:
There was an improvement! At least now my app can contact the Metro bundler and get a JS bundle. I'm now in the exact same situation as @janet-rivas (red screen warning for "Native module cannot be null"). |
I'm having the same issue - I removed This issue seems to only affect iOS, my Android build seems to be working as expected. |
This problem is a bit tricky to debug, but it was due to an incompatible package. I'm also using To debug which module was causing issues, I modified the constructor with the following patch (you could use a code break if you wanted, this is a quick and dirty hack): if (Platform.OS === 'ios') {
+ if (!nativeModule) {
+ console.trace()
+ }
invariant(nativeModule, 'Native module cannot be null.');
this._nativeModule = nativeModule;
} Then when you run your app, it will print the stack trace allowing you to see where the error is coming from: You can then click through to your component and see which module caused the invariant: I've not quite figured out a fix for this yet, I'll update this issue when I know what's going on. |
Another update, my issue was caused by the push notification package I'm using switching from the bundled iOS push notification handler to https://github.com/react-native-community/react-native-push-notification-ios This might not be what your specific issue is, but I think the same debugging technique will work for other projects with strange native module issues. Another thing that I found quite useful was to dump the list of loaded native modules like so:
That way you can see if anything you're expecting to be loaded is missing. |
I have just recently solved my issue. As mentioned by @edcs, it was indeed due to a third-party package (in this case it was opentok-react-native). For anyone experiencing this problem (@janet-rivas, etc.), I'm afraid the only solution is to methodically audit your third-party packages, one by one. It was good that I caught this, because
My app is now fully working on both platforms! |
I am facing same issue. any luck there? |
Please run |
I am also seeing this issue on react-native @MounirDhahri I tried what you suggested, but unlinking everything won't work because some of the libs I am using still do not support autolinking. Also, anything I do to iOS has knock on effects to Android, which is working as intended. My failure is only on iOS. This has to be an issue with an iOS implementation of some library specifically. |
any update on this issue? |
Not sure it it's the right place to ask but shouldn't the types for Currently there is:
The invariant for 'ios' clearly implies that even though the type specifies |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
I'm trying to update my RN from 0.59.5 to 0.60.5. I was able to get Android app to work fine, but the same app on iOS (whose build completes successfully otherwise) crashes on cold app start with an
RCTFatalException: Unhandled JS Exception: Native module cannot be null
error, right after the splash screen disappears. The Metro bundler doesn't show any communication from the simulator/device; when the iOS app launches and crashes, the Metro bunder terminal output is unchanged.This happens for both iOS Simulator and for real iOS devices running iOS 12.4 (iPhone SE, iPhone 8, and iPad 3rd generation).
Relevant facts:
Start Packager
Build Script (from Packager not starting after 0.59 to 0.60 migration #25585)localhost
exception in my Info.plist fileindex.android.js
andindex.ios.js
files, but don't believe this should have made a difference (please correct me if I'm wrong). MyAppDelegate.m
contains the followingsourceURLForBridge
method (it uses CodePush when building the app for non-debug app, but this issue is purely for debug app):Relevant Xcode debug output:
React Native version:
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Memory: 24.93 MB / 16.00 GB
Shell: 5.6.2 - /usr/local/bin/zsh
Binaries:
Node: 10.16.2 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.4 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29
Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.0, 28.0.3, 29.0.0, 29.0.1
System Images: android-16 | Intel x86 Atom, android-16 | Google APIs Intel x86 Atom, android-17 | Google APIs Intel x86 Atom, android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-21 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5692245
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native-rename: 2.2.2
Steps To Reproduce
Start Packager
script in app's Xcode Build Phases (from Packager not starting after 0.59 to 0.60 migration #25585)react-native run-ios
or through opening the .xcworkspace file and clicking the build ("run") button; observe successful buildRCTFatalException: Unhandled JS Exception: Native module cannot be null
The text was updated successfully, but these errors were encountered: