com.facebook.react.common.JavascriptException TypeError: undefined is not an object (evaluating 'n.replace'), stack

Am currently using expo SDK 42, i have to build my app and distributed it to the stores, however, when i use EAS i get the error below, I have distributed it using expo build and it now works perfect, I have researched on this for two days now and can’t get an reason why this is happening since the APK is working perfect and also the app launches successfully on the expo Go app.

com.facebook.react.common.JavascriptException: TypeError: undefined is not an object (evaluating 'n.replace'), stack:
getHostUri@2373:5345
makeUrl@2373:1526
<unknown>@2718:819
loadModuleImplementation@2:1837
<unknown>@959:937
loadModuleImplementation@2:1837
<unknown>@500:1383
loadModuleImplementation@2:1837
<unknown>@6:69
loadModuleImplementation@2:1837
guardedLoadModule@2:1091
global code@3188:3
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java
  at java.lang.reflect.Method.invoke (Native Method)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:151)
  at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
  at android.os.Handler.handleCallback (Handler.java:883)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:214)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:919)

Hey @ariahealth, want to clarify something before we dive in here…are you saying a SDK42 binary built via expo build works as expected but one built with EAS does not? (Just want to make sure both are on the same SDK versions)

Yes, am using SDK 42, expo build works and i have even deployed on production, but the EAS build is completed but when I open the app i find the above error and the app crashes, I can’t seem to find why this is hapenning

Both builds are completed but the EAS build crashes

This could be because you’re relying on some native code that’s included by default when you use Expo Go (or expo build), but you have not included it in your list of dependencies in package.json.

What dependencies do you have in package.json?

Also, what errors do you get in the adb logcat output when the app crashes?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.