找不到EventDispatcher React Native的模块

时间:2019-02-26 10:25:30

标签: react-native

使用react-native run-ios启动应用程序时,它在模拟器Unable to find module for EventDispatcher上显示错误

enter image description here

6 个答案:

答案 0 :(得分:19)

  1. 停止远程JS调试并重新加载应用程序

它将为您提供适当的错误消息,很可能会丢失您组件之一上的某些渲染。这为我解决了。

答案 1 :(得分:4)

将RN从static HashMap<Integer, Integer> memo = new HashMap<Integer, Integer>(); public static void main(String argv[]) { int n = 1000; System.out.println(getSteps(n, 0,0 )); } public static int getSteps(int n, int sum, int count) { if(n == sum) { return 1; } if(sum > n) { return 0; } if(memo.containsKey(sum)) { return memo.get(sum); } for(int i=1; i<=3;i++) { sum = sum + i; count += getSteps(n, sum, 0); sum = sum - i; memo.put(sum, count); } return count; } 升级到v0.57.3后,我开始收到此错误。 使用v0.58.6 / yarn start -reset-cache运行打包程序对我来说解决了这个问题。

答案 2 :(得分:4)

在某些版本高于0.58的RN中使用远程调试器时,这似乎是一个问题。使用react-native-debugger应该可以解决此问题,因为它已经支持上述RN版本。

可以从以下链接下载: https://github.com/jhen0409/react-native-debugger/releases

答案 3 :(得分:1)

因此,在我升级到RN 0.59.x之后,这个问题发生在我身上。 启用实时重载或尝试通过按CMD + R刷新iOS屏幕时,我收到此错误。

相关问题:

  • 无法找到UIManager的模块
  • 无法找到以下模块 DevLoadingView
  • 无法找到EventDispatcher的模块

这是我解决的方法:

编辑您的AppDelegate.m文件,并在@end之前添加以下代码


#if RCT_DEV
- (BOOL)bridge:(RCTBridge *)bridge didNotFindModule:(NSString *)moduleName {
  return YES;
}
#endif

这将解决问题。

实时重新加载和调试模式现在都应该可以正常工作了。

答案 4 :(得分:1)

我正在使用排毒,对我有用的是从

切换构建命令

-configuration Debug-configuration Release

它将不再从 Metro bundler 中获取,而是使用构建中的 js 包。当我编写测试代码时,我使用 debug 进行构建,因为我偶尔会看到错误,因为我喜欢不必经常构建并让 Metro bundler 为我做这件事的包容性。

答案 5 :(得分:0)

对我有用的只是{@ {@}},如@Hackman所述, 然后杀死浏览器调试器,清理Xcode并重建。

无法告诉您原因,但是问题消失了。