Android Studio 为构建设置节点目录(原因:error=2, No such file or directory) [英] Android Studio setting node directory for build (Cause: error=2, No such file or directory)

查看:87
本文介绍了Android Studio 为构建设置节点目录(原因:error=2, No such file or directory)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目构建失败,因为它使用了错误的目录来运行 Node.js.如何为这些编译时任务设置 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 为构建设置节点目录(原因:error=2, No such file or directory)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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