ios - react-native 链接错误“未知依赖项”
问题描述
我正在按照示例构建一个小型视频聊天:https ://www.agora.io/en/blog/how-to-build-a-react-native-video-calling-app-using-agora
我通过以下方式创建了一个新项目:npx react-native init AwesomeProject
我添加了必要的依赖项:
npm install --save react-native-agora
npm install --save react-native-router-flux
npm install --save react-native-vector-icons
依赖关系也可以在 package.json 中看到
...
"dependencies": {
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-agora": "^2.9.1-alpha.2",
"react-native-router-flux": "^4.0.6",
"react-native-vector-icons": "^6.6.0"
},
...
当我通过npx react-native run-ios
应用程序启动应用程序时,将在我的版本 10.2.1 (SimulatorApp-880.5 CoreSimulator-587.35)上启动
我收到以下错误:Invariant Violation: Native module cannot be null. constructor NativeEventEmitter.js
我尝试重建它npm install
并且构建成功。
我的猜测是我错过了将 react 链接到 react-native-agora。我试图将其链接,react-native link react-native-agora
但我收到以下错误消息:
error Unknown dependency. Make sure that the package you are trying to link is already installed in your "node_modules" and present in your "package.json" dependencies.
提前致谢。
解决方案
我在 npm 上遇到了类似的问题,正如Nishant评论的那样尝试删除node_modules
文件夹并尝试npm install
或yarn install
.
推荐阅读
- go - 从不同的 goroutine 访问服务层以进行并发执行
- java - 我的应用程序是否由于内存泄漏或隐私侵犯而退出?
- python - 如何在我们的项目目录中包含一个 python 模块?
- mongodb - 更改端口后无法远程连接-Mongodb
- x++ - 从 inventdim 获取具有 transactionid D365 的最新信息
- c - GTK - 关闭窗口时运行功能
- rust - 如何检查大于 2 ^ 54 的 u64 数是否可被 f64 整除且精度损失最小?
- python - 将 Python 程序中的数据保存到“工作区”中,这样我就可以绘图而无需再次运行程序
- reference - 我们可以在 cox 回归 SPSS 的参考组中添加非预测变量吗?
- passenger - 乘客最小实例不与乘客 ruby 2.3 docker 一起使用