Closed alyiev closed 1 year ago
Did https://expo.github.io/router/docs/troubleshooting/#expo_router_app_root-not-defined
and now getting this:
ERROR Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of `GestureHandler`.
in GestureHandler (created by ExpoRoot)
in ExpoRoot (created by App)
in App (created by withDevTools(App))
in withDevTools(App)
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in main(RootComponent)
Reverted to 1.4.3 and it works fine.
What is the problem here in the new version?
The @next
version of expo-router
(used for v2) has a new native module on iOS that requires a native rebuild. In Expo Go, Android, and web this is not an issue. To fix, simply npx expo run:ios
or eas build
.
@EvanBacon doesn't help, getting the same issue
When I run my project on Expo Go, I get this error:
Error: Cannot find native module 'ExpoDevMenu', js engine: hermes
And, Yes I'm using Expo Router.
Just Updated my project from Expo 48 to ^49.0.0, Today.
When I run my project on Expo Go, I get this error:
Error: Cannot find native module 'ExpoDevMenu', js engine: hermes
And, Yes I'm using Expo Router.
same here but am not using expo router
@EvanBacon Encountering the same issue.
Previously I had an index.js
file in the root directory:
import { registerRootComponent } from 'expo';
import App from './App';
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
The referenced above ./App
was a App.tsx
also placed in the root directory:
import 'expo-dev-client';
import Root from './src';
export default Root;
And then the Root
was basically the whole app.
Now – do I understand it correctly – I don't need any of these as the main
in package.json
became expo-router/entry
?
I'm using expo@49.0.6
with expo-router@2.0.0
. I've removed pakcage-json.lock
, node_modules
, ios
, and did npx expo run:ios
What I get is:
ERROR Error: Cannot find native module 'ExpoHead', 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
Edit
No idea why the answers come always after writting an issue or a SO post, but – I was migrating to expo-router@2.0.0
from @react-native/navigation
and I had an app built with previous setup. Doing clean install (removing package-lock.json
file, node_modules
&ios
directories, then npm install
, then launching the simulator and removing the previously visible app, and then doing npx expo run:ios
helped.
Make sure you are not using development build. use expo go
Make sure you are not using development build. use expo go
You might say "make sure you're not using expo" as well
I'm having the same error: ERROR Error: Cannot find native module 'ExponentAV', js engine: hermes. I'm using dev build of expo with expo cli. What should I do?
I'm having the same error: ERROR Error: Cannot find native module 'ExponentAV', js engine: hermes. I'm using dev build of expo with expo cli. What should I do?
Same here...
Same here
I'm having the same error: ERROR Error: Cannot find native module 'ExponentAV', js engine: hermes. I'm using dev build of expo with expo cli. What should I do?
Same, any update?
Running into a similar issue,
ERROR Error: Cannot find native module 'ExponentAV', js engine: hermes
After experimenting a bit more, it seems to be happening on my EAS install for dev mode (Have no tried prod). However, on the simulator and Expo Go, it seems to be fine.
EDIT:
An update, I managed to resolve my issue. As it turns out, I had to rebuild my EAS dev build. Might be related, but when running expo-doctor
, it warned me about the following:
Check for common project setup issues
Upon further inspection, it turns out I was committing my ios
and android
folder so I had to remove that, and add both folders to my .gitignore
.
Then I rebuilt my EAS dev build, reinstalled the whole app from scratch again, then booted my dev server using npm run ios
and it no longer yells at me about this issue.
Same, any update?
Same, Any update? Been trying to debug for the past 2 weeks
What worked for me was to run npx expo run:ios
. In my case i'm mainly developing for iOS. Also make sure your routes are set up correctly. Fix your with an href
pointing to a non existing route.
Which package manager are you using? (Yarn is recommended)
yarn
Summary
ERROR Error: Cannot find native module 'ExpoHead', js engine: hermes ERROR Invariant Violation: "main" has not been registered. This can happen if:
AppRegistry.registerComponent
wasn't called., js engine: hermesMinimal reproducible example
using yarn 3.5+
index.tsx:
_layout.tsx: