繁体   English   中英

反应原生链接错误“未知依赖”

[英]react-native link error 'Unknown dependency'

我正在按照示例构建一个小型视频聊天: 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 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 installyarn install

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM