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?
The specific task is:
app:recordFilesBeforeBundleCommandDebug
And the related error:
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
我在 MacOS 上运行 Android Studio,以下对我open -a "Android Studio.app"
:Yoruba's answer above and open -a "Android Studio.app"
the application from Terminal with open -a "Android Studio.app"
Add this to the build.gradle if you use React-Native
ext {
react = [
nodeExecutableAndArgs: ["/usr/local/bin/node"]
]
}
我遇到了同样的问题并通过再次安装 node.js 解决了,因为 react 无法找到它。
It is a known bug for the environment:
Upgrade to Gradle version 6.9 or above in the gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip
Find the node path in your system using command
which node
inside terminal Then open app/build.gradle
and add this line
ext {
react = [
nodeExecutableAndArgs: ["Node path from the above command"]
]
}
After that it may ask to upgrade kotlin version then add this in build.gradle
buildscript {
ext {
kotlinVersion = "1.6.0"
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.