Expo iOS扫码后出现原生模块不存在及Main未注册错误求助
Expo iOS运行报错求助
错误信息
Invariant Violation: Your JavaScript code tried to access a native module that doesn't exist.
If you're trying to use a module that is not supported in Expo Go, you need to create a development build of your app.
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.registerComponentwasn't called., js engine: hermes
环境信息
expo-env-info 1.0.5 environment info: System: OS: Windows 10 10.0.19045 Binaries: Node: 20.5.1 - C:\Program Files\nodejs\node.EXE npm: 10.2.5 - C:\Program Files\nodejs\npm.CMD npmPackages: react: 18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 react-native: 0.72.6 => 0.72.6 react-native-web: ^0.19.10 => 0.19.10 transport-market: 49.0.21 Expo Workflow: managed
package.json内容
{ "name": "transport-market", "version": "1.0.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web" }, "dependencies": { "@expo/config-plugins": "~7.2.2", "@react-native-async-storage/async-storage": "^1.21.0", "@react-native-firebase/app": "^18.7.3", "@react-native-firebase/auth": "^18.7.3", "@react-native-firebase/firestore": "^18.7.3", "@react-navigation/bottom-tabs": "^6.5.11", "@react-navigation/native": "^6.1.9", "@react-navigation/stack": "^6.3.20", "@types/react": "~18.2.14", "expo": "~49.0.15", "expo-status-bar": "~1.6.0", "firebase": "^10.7.1", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.72.6", "react-native-gesture-handler": "~2.12.0", "react-native-paper": "^5.11.6", "react-native-safe-area-context": "^4.8.2", "react-native-screens": "~3.22.0", "react-native-vector-icons": "^10.0.3", "react-native-web": "^0.19.10", "typescript": "^5.1.3" }, "devDependencies": { "@babel/core": "^7.20.0" }, "private": true }
已尝试操作
- 创建Expo开发构建
- 检查并重启Metro服务(确认运行路径正确)
问题仍未解决,且错误未明确指出具体引发问题的模块,恳请提供解决方案。
内容的提问来源于stack exchange,提问作者emirryhn
相关产品推荐
相关产品推荐

