javascript - 如何修复:TypeError:null 不是对象(评估“AgoraRtcChannelModule.prefix”)?
问题描述
每次我将 RtcEngine 导入我的应用程序 ( import RtcEngine from 'react-native-agora';
) 时,我都会收到以下错误:
TypeError: null is not an object (evaluating 'AgoraRtcChannelModule.prefix')
at node_modules\react-native\Libraries\LogBox\LogBox.js:148:8 in registerError
at node_modules\react-native\Libraries\LogBox\LogBox.js:59:8 in errorImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:33:4 in console.error
at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:171:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
at node_modules\expo-error-recovery\build\ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:36 in tryCatch
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:288:29 in invoke
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:36 in tryCatch
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:152:27 in invoke
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:162:18 in Promise.resolve.then$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue
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.
at node_modules\react-native\Libraries\LogBox\LogBox.js:148:8 in registerError
at node_modules\react-native\Libraries\LogBox\LogBox.js:59:8 in errorImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:33:4 in console.error
at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:171:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
at node_modules\expo-error-recovery\build\ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:36 in tryCatch
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:288:29 in invoke
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:36 in tryCatch
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:152:27 in invoke
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:162:18 in Promise.resolve.then$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue
注意:这是没有任何电话的。
对此的任何帮助将不胜感激。我对 react-native 和 javascript 还很陌生,所以我希望我已经提供了足够的信息。
解决方案
Agora SDK 是一个原生模块,我看到你正在尝试将它与 expo 一起使用。Expo 托管工作流不支持原生模块,您可以弹出到裸工作流或使用 react-native CLI。
更新: Expo 现在支持使用本机模块,而无需使用自定义开发客户端弹出到裸 wofklow,您可以在此处
了解有关在 Agora 中使用它们的更多信息。
推荐阅读
- wordpress - wordpress wp-includes 防止目录访问
- python - Python 2.7:如何使用 PySimpleGUI27 从我的 GUI 应用程序中删除 Tkinter 徽标?
- jsp - 是否需要在加载时检查一个 if case 后禁用 JSF 页面的所有组件(CommandLink、selectionOneRadio)?
- javascript - 节点模块不能在 Nativescript 应用程序中使用
- angular - 使用 VSTS 管道创建 Angular Docker 映像的问题
- ios - 如何识别 iOS 应用程序是否连接到特定的 WiFi 网络?
- javascript - 如何将变量值分配给ajax块中的xml字段
- java - 在尝试“apt install openjdk-8-jre-headless”和“apt install openjdk-8-jdk”后,java 不可用
- django - 有没有办法在 django 中扩展创建的模型字段另一个模型?
- angular - Angular 6 基于角色的身份验证