Android Studio设置用于构建的节点目录(原因:错误= 2,没有此类文件或目录) [英] Android Studio setting node directory for build (Cause: error=2, No such file or directory)

查看:555
本文介绍了Android Studio设置用于构建的节点目录(原因:错误= 2,没有此类文件或目录)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目构建失败,因为它使用了错误的目录来运行Node.我该如何为这些编译时任务设置Node目录?

My project build fails because it's using the incorrect directory to run Node. How do I go about setting the Node directory for these compile-time tasks?

具体任务是:

app:recordFilesBeforeBundleCommandDebug

app:recordFilesBeforeBundleCommandDebug

以及相关的错误:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:recordFilesBeforeBundleCommandDebug'.
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'node''
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'node'
Caused by: java.io.IOException: Cannot run program "node" (in directory "/Users/me/Code/appname/android/app"): error=2, No such file or directory
Caused by: java.io.IOException: error=2, No such file or directory

推荐答案

如果使用React-Native,则将其添加到build.gradle中

Add this to the build.gradle if you use React-Native

ext {    
    react = [
        nodeExecutableAndArgs:  ["/usr/local/bin/node"]
    ]
}

这篇关于Android Studio设置用于构建的节点目录(原因:错误= 2,没有此类文件或目录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆