Unable to find module for EventDispatcher React Native - react-native

On starting application using react-native run-ios its showing error on simulator Unable to find module for EventDispatcher

Stop remote JS debugging and then reload the app
It will give you the appropriate error message, most likely missing some render on one of your components. That fixed it for me.

So this issue happened to me after I upgraded to RN 0.59.x.
I was getting this error when live reload was enabled or if i tried to refresh screen on iOS by pressing CMD+R.
Related issues:
Unable to find module for UIManager
Unable to find module for
DevLoadingView
Unable to find module for EventDispatcher
Here's how I solved it:
Edit your AppDelegate.m file and add the following code before the #end
#if RCT_DEV
- (BOOL)bridge:(RCTBridge *)bridge didNotFindModule:(NSString *)moduleName {
return YES;
}
#endif
This will fix the issue.
Link to the fix on github.
Related discussion on github.
Live reload and debug mode all should work without problems now.

This seems to be an issue when using the remote debugger with certain RN versions above 0.58. Using react-native-debugger should solve the issue as it supports RN versions above already.
It can be downloaded from the following link:
https://github.com/jhen0409/react-native-debugger/releases

I've started receiving this error after upgrading RN from v0.57.3 to v0.58.6.
Running packager with yarn start -reset-cache / react-native start --reset-cache fixed the issue for me.

What worked for me was simply stopping remote debugging as mentioned by #Hackman,
THEN killing the browser debugger, cleaning Xcode and rebuilding.
Couldn't tell you why, but the issue went away.

I'm using detox, what worked for me was switching the build command from
-configuration Debug
to
-configuration Release
It will no longer fetch from metro bundler and instead use the js bundle from the build. When I'm coding the tests, I build with debug since I'm fine with occasionally seeing the error, since I like the connivence of not having to constantly build and letting metro bundler do it for me.

Related

React Native TypeError: Cannot read property 'indexOf' of undefined, js engine: hermes

I am working on a react-native project. I have been running the application on Android and iOS devices for the past 6 months. I haven't faced any problems till now. But suddenly today, while I am trying to run the application I am getting a compile error with the description. TypeError: Cannot read property 'indexOf' of undefined, js engine: hermes. I tried to debug the issue and found that there is an issue while connecting to the remote debugger. But the strange thing here is even I haven't selected the remote debugging option from either of emulator or simulator.
So, I have enabled the remote debugging option from the emulator to get a quick fix. It is working fine. But why is it connected to the remote debugger even after the fresh installation? And the quick fix comes with its own issues. The application is functioning a bit lag and inconsistent. I suspect there is an issue with the metro bundler. I have removed the cache using rm -rf /tmp/metro-* command, cleaned gradle using ./gradlew clean command, and cleaned iOS build by deleting derived Data. But still, the issue persists.
Is there any other step am I missing here? If it is the issue with the metro bundler, is there any way to reset it completely? Please check the attached image for more information.
The reason for this issue in my case is not with the metro bundler or its cache but with one of the third-party dependency named auth0-js(In your case it would be different). It is adding some global or window properties which are causing the above-mentioned issue. I have removed it and replaced with the library which is closed to react-native ecosystem which eventually resolved the issue.

"Unable to resolve module" debuggerWorker errors in recent react-native releases

I keep my project(s) relatively up to date with the latest RN releases. This error seems to be coming up more and more lately.
Error: Unable to resolve module `./debugger-ui/debuggerWorker.d9da4ed7` from ``:
None of these files exist:
* debugger-ui/debuggerWorker.d9da4ed7(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
Really makes it hard when trying to debug issues and a debugger statement does noting and errors are not reported to the browser tab where the console output goes.
I've already tried wiping node_modules. Is this a known issue with a concrete fix available?
Got stuck with this exact issue for hours. Just found that this occurs only on device where app is already installed with debug mode enabled.
I fixed it by:
uninstalling manually app from device (cmd+H to display simulator home) then long click on app icon and click on cross to delete app => this forces disabling debug mode,
then run app again from xcode.
Enabling debug mode after that works normally.
I had to come across a similar issue after updating #react-native-community/cli-debugger-ui to 4.2.1. Tried out several methods, nothing worked. Reverting #react-native-community/cli-debugger-ui back to 3.0.0 resolved the issue for me.
I closed the app (pressing home twice and swiping up), then started it again from the simulator and it worked.
Happens to me recently using expo and android.
The solution was to clear all Expo Go data:
Long press the Expo go icon
Then select App info
At the bottom of the screen, press Clear Data
And press Clear all data
Relaunch expo go and the react native app

react-native android app quits before it launches (0.61.2) - couldn't find DSO to load: libhermes.so - Channel is unrecoverably broken

I have been trying to migrate from react-native 0.59.4 to 0.61.2.
After solving many many build and runtime problems on ios and android, this was the final problem before the successful launch of my react-native app on android. The app would build successfully but when it is time to launch on the emulator it would pop for a very brief moment then a white screen and application crashed with an app keeps crashing type of popup message. I can't even debug the app remotely on the chrome console since it doesn't launch in the first place.
Any ideas?
Note: This solution worked for my specific problem. To find out your problem try adb logcat *:E to see what is wrong in your case.
Ok, there is a very important command (I am on mac) that helps you see in the logs what is going on even if you can't launch the app on emulator: adb logcat *:E
In my case there were 2 main problems that caught my attention in the logs.
Channel is unrecoverably broken and will be disposed
and
couldn't find DSO to load: libhermes.so
Once I got these messages on my radar I started to dig/google for them.
After going through a lot of SO and GitHub topics here is what worked for me:
First, make sure you have made all the necessary modifications in your:
gradle.properties
app/build.gradle
android/build.gradle
package.json
etc
files (Use react-native upgrade helper to do this).
Then, if it is not installed already, do npm install jsc-android to install the required jsc package on your project.
Add the below in android/build.graddle inside allprojects -> repositories
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
Inside gradle.properties add
android.useAndroidX=true
android.enableJetifier=true
In some cases you may need to add below line to package.json
"postinstall": "npx jetify"
Also, in some cases it may help to replace the below line (dependencies section of app/build.gradle) with the exact version of the react-native you are using:
implementation "com.facebook.react:react-native:+"
Replace like so:
implementation "com.facebook.react:react-native:**0.61.2**"
I hope this helps to solve or at least make some progress with your problem.
Cheers.

React Native App crashes if signed and released. Works fine in debug mode

React Native App crashes if signed and released. Works fine in debug mode. It doesn't throw any error in the screen. It simply crashes. When I looked at cat log. no error.
I also tried build apk with --info, but no additional info while crashing. I also tried building APK by setting minifyEnabled false.
When run the app in debug mode by connecting my phone via USB, it works.
I'm tried creating apk with --debug but I'm unable to install it my phone, it says parsing error when I try to install using app installer.
I got the following logcat errors. What does it mean?
09-03 11:03:07.968 W/ActivityManager(1344): Force finishing activity com.myapp/.MainActivity
09-03 11:03:08.012 W/BroadcastQueue(1344): Skipping deliver [background] BroadcastRecord{cb72147 u-1 android.net.conn.CONNECTIVITY_CHANGE} to ReceiverList{7bf2161 22421 com.myapp/10100/u0 remote:b9cdcc8}: process crashing
09-03 11:03:08.035 W/ActivityManager(1344): Dismiss app error dialog : com.myapp
09-03 11:03:13.095 I/WindowState(1344): WIN DEATH: Window{3f22c22 u0 /com.myapp.MainActivity}
I finally found the cause. There is module called react-native-material-design-searchbar which was causing the issue. The weird part is, if directly copy the SearchBar.js from that module and use it all works fine even in release, but if use module as direct import it's not working only in release mode. So weird. The SearchBar is good, so now I'm using directly by copying the file to my project.
I fixed this error by uninstalling uglifyjs and reinstalled the latest (using NPM).

"babelHelpers.interopRequireDefault is not a function" when upgrading to React Native 0.16.0-rc

I upgraded to react-native 0.16.0-rc, ran npm install, then ran react-native upgrade. When trying to launch the iOS app in a simulator (or device, doesn't matter) I get the error:
[error][tid:com.facebook.React.RCTExceptionsManagerQueue] Unhandled JS Exception: babelHelpers.interopRequireDefault is not a function. (In 'babelHelpers.interopRequireDefault(_reactNative)', 'babelHelpers.interopRequireDefault' is undefined)
I've just about run out of ideas here. Is there something I need to add to my xcode project maybe? Merging the latest react-native templates into mine was a nightmare so maybe something got messed up there.
This problem is discussed in this Github issue and fixed by this commit. You can apply this patch temporarily until it is merged into the project with the version 0.16.