React Native & iOS : Invariant Violation: Module RCTDeviceEventEmitter is not a registered calla

Posted

技术标签:

【中文标题】React Native & iOS : Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)【英文标题】: 【发布时间】:2021-04-27 07:38:11 【问题描述】:

我一直在用 react native 做一个项目。我们在一个团队中工作。代码很好。然后有一天,我的合作伙伴向 repo 推送了更新。该代码在他的 macbook 中运行良好。但就我而言,我遇到了一些错误,如下所示。这个错误像无限循环一样在我的控制台中不断重复。请帮帮我。

2021-04-27 16:50:58.651850+0900 MyApp[1722:470282] [native] Running application MyApp (
    initialProps =     
    ;
    rootTag = 1;
)
2021-04-27 16:50:58.716771+0900 MyApp[1722:470464] 7.6.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2021-04-27 16:50:59.389717+0900 MyApp[1722:470471] [native] RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks
2021-04-27 16:51:02.004739+0900 MyApp[1722:470468] [connection] nw_socket_handle_socket_event [C6:1] Socket SO_ERROR [61: Connection refused]
2021-04-27 16:51:02.006678+0900 MyApp[1722:470464] [connection] nw_connection_get_connected_socket [C6] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-04-27 16:51:02.006797+0900 MyApp[1722:470464] TCP Conn 0x28068cb00 Failed : error 0:61 [61]
2021-04-27 16:51:03.026929+0900 MyApp[1722:470488] [javascript] 'Locales =>', [  isRTL: false,
    languageCode: 'en',
    languageTag: 'en-KR',
    countryCode: 'KR' ,
   isRTL: false,
    languageCode: 'ko',
    languageTag: 'ko-KR',
    countryCode: 'KR' ,
   isRTL: false,
    languageCode: 'ms',
    languageTag: 'ms-KR',
    countryCode: 'KR'  ]
2021-04-27 16:51:03.357908+0900 MyApp[1722:470488] [javascript] Initialize - Push, Notification
2021-04-27 16:51:03.402203+0900 MyApp[1722:470488] [javascript] Invariant Violation: Module RCTLog is not a registered callable module (calling logIfNoNativeHook)
2021-04-27 16:51:03.428189+0900 MyApp[1722:470488] [javascript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication) Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.021025+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.028693+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.031414+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.039040+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.044973+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.050134+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.054998+0900 MyApp[1694:462504] [javascript] Invariant Violation: No callback found with cbID 4923 and callID 2461 for module <unknown>. Args: '[231]'
    2021-04-27 16:25:29.060805+0900 MyApp[1694:462504] [javascript] Invariant Violation: No callback found with cbID 4939 and callID 2469 for module <unknown>. Args: '[232]'
    2021-04-27 16:25:29.065863+0900 MyApp[1694:462504] [javascript] Invariant Violation: No callback found with cbID 4955 and callID 2477 for module <unknown>. Args: '[233]'
    2021-04-27 16:25:29.070933+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.076179+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.081011+0900 MyApp[1694:462504] [javascript] Invariant Violation: No callback found with cbID 4971 and callID 2485 for module <unknown>. Args: '[234]'
    2021-04-27 16:25:29.086752+0900 MyApp[1694:462504] [javascript] Invariant Violation: No callback found with cbID 4987 and callID 2493 for module <unknown>. Args: '[235]'
    2021-04-27 16:25:29.092208+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.096989+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.102638+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.107905+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.113361+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.118681+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.124229+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.129071+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.134937+0900 MyApp[1694:462504] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit)
    2021-04-27 16:25:29.140182+0900 MyApp[1694:462504] [javascript] Invariant Violation: No callback found with cbID 5003 and callID 2501 for module <unknown>. Args: '[236]'
    2021-04-27 16:25:29.145136+0900 MyApp[1694:462504] [javascript] Invariant Violation: No callback found with cbID 5019 and callID 2509 for module <unknown>. Args: '[237]'

【问题讨论】:

【参考方案1】:

我认为您没有关注正确的错误。通过快速查找“Module AppRegistry is not a registered callable module”,我在网上找到了很多帮助,比如这个问题:https://github.com/facebook/react-native/issues/26687#issuecomment-537504575

因此,这可能是一种常见情况,您可能需要清理缓存,或者/而您忘记链接新库/安装您的 pod。

典型的命令是:

$ watchman watch-del-all && react-native start --reset-cache
$ cd ios && pod install && cd ..
  OR
$ cd ios && rm -rf Pods && pod cache clean --all && pod install && cd ..

然后清理您的项目并在 Xcode 下再次构建。

【讨论】:

以上是关于React Native & iOS : Invariant Violation: Module RCTDeviceEventEmitter is not a registered calla的主要内容,如果未能解决你的问题,请参考以下文章

React Native Expo branch.io

[RN] React Native 封装选择弹出框(ios&android)

react-native 在iOS上使用http链接的图片地址不显示| iOS9 & iOS10 HTTP 不能正常使用的解决办法

React Native:在执行“yarn ios”后构建失败

REACT NATIVE 系列教程之七统一ANDROID与IOS两个平台的程序入口&&区分平台的组件简介

在 iOS 上安装 react-native-firebase 的问题