react-nativenpmreact-native-hermes

npx react-native run-ios runs with Hermes errors


I've been trying to run npx react-native run-ins for the past hour and I've been getting these errors:

 ERROR  TypeError: undefined is not a function, js engine: hermes
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Bridgeless Mode: false. Registered callable JavaScript modules (n = 9): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, HMRClient.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

I looked around on GitHub, stack overflow and asked some friends but the issue seems to still be there

I tried uninstalling and reinstalling the pod files (rm -rf Pods/ && rm -rf Podfile.lock && pod install), I tried pod update, I tried clearing the cache of npm, uninstalling the node_modules and re-installing and uninstalling them, and installing with Yarn


Solution

  • As you are getting an error related to Hermes and you mentioned that you copied the packages from an old project, my understanding is that you are on the latest SDK 48 which uses Hermes as the default JavaScript Engine but as you have copied files from the old project which might not be on SDK 48 and that's why it is throwing this error.

    Solution

    If you are ok with using JavaScriptCore (JSC) as your default, you need to mention that specifically.