首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在创建Android构建时找不到React Webrtc模块

在创建Android构建时找不到React Webrtc模块
EN

Stack Overflow用户
提问于 2020-06-16 11:40:32
回答 1查看 830关注 0票数 4

我在我的本机应用程序中添加了Webrtc https://www.npmjs.com/package/react-native-webrtc模块。

我使用了npm i -s react-native-webrtc命令。但是,在创建构建时,我会遇到以下错误:

错误:错误:无法从App.js:react本机-webrtc解析模块react-native-webrtc,无法在项目中或这些目录: node_modules中找到

如果您确定该模块存在,请尝试以下步骤: 1.清除看守手表-del-all 2.删除node_modules: rm -rf node_modules并运行纱线安装3.重置麦德龙的缓存:纱线启动-复位-缓存4.删除缓存: rm -rf /tmp/m-* at ModuleResolver.resolveDependency -rf at ResolutionRequest(D:\smartek_project\video_conferencing\newchanges\VC_Frontend\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18) at DependencyGraph.resolveDependency (D:\smartek_project\video_conferencing\newchanges\VC_Frontend\node_modules\metro\src\node-haste\DependencyGraph.js:287:16) at Object.resolve (D:\smartek_project\video_conferencing\newchanges\VC_Frontend\node_modules\metro\src\(D:\smartek_project\video_conferencing\newchanges\VC_Frontend\node_modules\metro\src\DeltaBundler\traverseDependencies.js:434:31) at Array.map ()在resolveDependencies (D:\smartek_project\video_conferencing\newchanges\VC_Frontend\node_modules\metro\src\DeltaBundler\traverseDependencies.js:431:18) at D:\smartek_project\video_conferencing\newchanges\VC_Frontend\node_modules\metro\src\DeltaBundler\traverseDependencies.js:275:33 at Generator.next () at asyncGeneratorStep (D:\smartek_project\video_conferencing\newchanges\VC_Frontend\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)

这是我的package.json依赖

代码语言:javascript
复制
"dependencies": {
    "@babel/polyfill": "^7.10.1",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/voice": "^1.1.4",
    "@react-navigation/bottom-tabs": "^5.5.1",
    "@react-navigation/native": "^5.5.0",
    "@react-navigation/stack": "^5.4.1",
    "babel-plugin-react-native-web": "^0.12.2",
    "core-js": "^3.6.5",
    "react": "16.11.0",
    "react-dom": "^16.13.1",
    "react-native": "^0.62.2",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-reanimated": "^1.9.0",
    "react-native-safe-area-context": "^3.0.2",
    "react-native-screens": "^2.8.0",
    "react-native-web": "^0.12.2",
    "react-native-webrtc": "^1.75.3"
  },
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-17 08:35:43

我为这个问题挣扎了很多天。只要按照我想好的指示就行了。(我正在使用react-native-cli)

Step 1:

代码语言:javascript
复制
$ rm -rf node_modules/
$ npm i
$ npm i react-native-webrtc --save

Step 2:用这个URL https\://services.gradle.org/distributions/gradle-5.5.1-all.zip替换distributionUrl

Step 3:从这个文件中用这个classpath("com.android.tools.build:gradle:3.4.1")替换你的classpath

Step 4:

代码语言:javascript
复制
$ cd android
$ ./gradlew clean
$ cd ..
$ react-native run-android

希望这能成功。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62407604

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档