expo: ERROR TypeError: 0, _expoModulesCore.requireOptionalNativeModule is not a function (it is undefined), js engine: hermes
Minimal reproducible example
Android Bundling complete 13373ms ERROR TypeError: 0, _expoModulesCore.requireOptionalNativeModule is not a function (it is undefined), js engine: hermes ERROR TypeError: 0, _expoModulesCore.requireOptionalNativeModule is not a function (it is undefined), js engine: hermes ERROR Invariant Violation: “main” has not been registered. This can happen if: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project. * A module failed to load due to an error and AppRegistry.registerComponent wasn’t called., js engine: hermes
Summary
Everything was working about 2 weeks ago, but now I’m getting errors. Nothing has changed in the code
Environment
expo-env-info 1.2.0 environment info: System: OS: Windows 10 10.0.19042 Binaries: Node: 18.16.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: AI-223.8836.35.2231.11005911 npmPackages: expo: ^49.0.21 => 49.0.22 expo-router: ^2.0.0 => 2.0.14 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.72.6 => 0.72.6 Expo Workflow: managed
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Reactions: 4
- Comments: 25 (2 by maintainers)
Fixed by adding into my package.json
Mine worked by adding “@expo/config-plugins”: “7.2.2”, “expo-constants”: “~14.4.2”,) and then running npx expo install --fix
thx work for me
I also just got this issue after i rm -rf my node_modules and package-lock.json and then npm install. It was working perfectly before this. However adding the “@expo/config-plugins”: “7.2.2”, did not work for me (i already have “expo-constants”: “~14.4.2”,).
I’ve published a new version of Router v2 (2.0.15) https://www.npmjs.com/package/expo-router/v/2.0.15 which has less forceful dependency versions.
I had the same problem. After installing the
expo-constants@~14.4.2package, it started working without any issues. It was not necessary to install the@expo/config-pluginspackage.alright will try this
@jianrontan Try
npx expo-doctorAny errors here?this is exactly what happend, was working fine till i had to remove node modules and re install, i’m using Node 18 and i already have expo config plugin installed as we as expo constants, do i have to uninstall and install again?