首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >react- Native -fs和rn-fetch-blob模块的React本机构建失败

react- Native -fs和rn-fetch-blob模块的React本机构建失败
EN

Stack Overflow用户
提问于 2018-09-13 19:15:31
回答 2查看 3K关注 0票数 1

当我运行npm run android时,我遇到了构建失败(在安卓的macOS上),并且我得到了以下构建失败:

代码语言:javascript
复制
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :react-native-fs.
     Required by:
         project :app
      > Unable to find a matching configuration of project :react-native-fs: None of the consumable configurations have attributes.
   > Could not resolve project :rn-fetch-blob.
     Required by:
         project :app
      > Unable to find a matching configuration of project :rn-fetch-blob: None of the consumable configurations have attributes.

显然,在node_modules/react-native-fs/androidnode_modules/rn-fetch-blob/android中,我只看到一个IML文件,没有看到特定于模块的代码。我是不是忘记正确下载了?我的android/settings.gradle文件如下:

代码语言:javascript
复制
rootProject.name = 'FooApp'
include ':react-native-version-number'
project(':react-native-version-number').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-number/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':rn-fetch-blob'
project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
include ':react-native-google-signin'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')

include ':app'

我是不是漏掉了什么明显的东西?

EN

回答 2

Stack Overflow用户

发布于 2018-09-13 19:32:20

您可以尝试删除文件夹node_modules,然后重新安装

代码语言:javascript
复制
rm -rf node_modules
npm install
react-native link

然后使用cd android && gradle clean清理安卓系统,并再次运行安卓系统

票数 2
EN

Stack Overflow用户

发布于 2018-09-13 19:49:17

我想直接运行命令

代码语言:javascript
复制
rm -rf node_modules && npm install

然后再运行react-native run-android就可以解决了

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

https://stackoverflow.com/questions/52312559

复制
相关文章

相似问题

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