升级MacOS Sonoma后Expo应用启动即崩溃:模块加载失败
Expo iOS应用在MacOS Sonoma启动崩溃:"未注册"错误排查求助
Intel Mac升级到MacOS Sonoma后,一款数月未改动、原本正常运行的Expo iOS应用启动即崩溃,报错信息如下:
iOS Bundled 411ms (index.js)
LOG Running "" with {"rootTag":21,"initialProps":{}}
ERROR Invariant Violation: "" 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.
已尝试更新所有npm包、重装pod,当前项目依赖配置如下:
"scripts": { "start": "expo start --dev-client", "android": "expo run:android", "ios": "npx expo run:ios", "web": "expo start --web", "build:ios": "eas build -p ios", "build:android": "eas build -p android", "build:all": "eas build -p all", "publish:ios": "eas submit -p ios", "publish:android": "eas submit -p android" }, "dependencies": { "@react-native-async-storage/async-storage": "^1.22.3", "@react-navigation/bottom-tabs": "^6.5.0", "@react-navigation/native": "^6.0.13", "@react-navigation/native-stack": "^6.9.1", "expo": "^50.0.8", "expo-clipboard": "^5.0.1", "expo-dev-client": "^3.3.9", "expo-font": "^11.10.3", "expo-image-picker": "^14.7.1", "expo-linear-gradient": "^12.7.2", "expo-splash-screen": "^0.26.4", "expo-status-bar": "^1.11.1", "react": "^18.2.0", "react-native": "^0.73.5", "react-native-animatable": "^1.3.3", "react-native-google-mobile-ads": "^13.0.2", "react-native-onesignal": "^5.0.6", "react-native-safe-area-context": "^4.9.0", "react-native-screens": "^3.29.0", "react-native-sound": "^0.11.2", "socket.io-client": "^4.5.4" }, "devDependencies": { "@babel/core": "^7.19.3" },
但应用仍无法运行,随后将index.js替换为最简测试代码:
import { registerRootComponent } from 'expo'; import { View } from 'react-native'; function App() { return <View />; } // Utilisation de registerRootComponent pour les applications Expo registerRootComponent(App);
已确认app.json中配置了应用名称,同时尝试直接使用AppRegistry注册组件,仍出现相同错误,且AppDelegate.mm中moduleName已设置为@"main",求可行的解决办法。
内容的提问来源于stack exchange,提问作者Medrupaloscil
相关产品推荐
相关产品推荐

