iOS端Expo-Router项目报错TypeError: Cannot read property 'EventEmitter' of undefined求助
iOS端React Native项目EventEmitter未定义报错的调试求助
我开发的项目在Web端渲染正常,但iOS端运行时出现报错(暂未测试Android),具体报错信息如下:
iOS Bundled 21824ms node_modules/expo-router/entry.js (3183 modules) iOS Bundled 171ms node_modules/expo-router/entry.js (1 module) (NOBRIDGE) LOG Bridgeless mode is enabled (NOBRIDGE) ERROR TypeError: Cannot read property 'EventEmitter' of undefined INFO 💡 JavaScript logs will be removed from Metro in React Native 0.77! Please use React Native DevTools as your default tool. Tip: Type j in the terminal to open (requires Google Chrome or Microsoft Edge). (NOBRIDGE) 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.
核心报错需重点关注:(NOBRIDGE) ERROR TypeError: Cannot read property 'EventEmitter' of undefined
我查看该TypeError的调用栈,发现包含metroRequire @ require.js:92。于是修改require.js,添加console.log(">> importing", module)日志,发现iOS端加载应用时,报错前总会导入stacktrace-parser模块。但检查stacktrace-parser的代码,用ag "EventEmitter"未找到相关引用。
即使把应用的Main组件简化为仅返回return <>;</>,仍然会触发这个错误,我判断这是导入相关的问题,请问该如何进一步调试?
内容的提问来源于stack exchange,提问作者Slackware
相关产品推荐
相关产品推荐

