我的項目構(gòu)建失敗,因為它使用不正確的目錄來運行 Node.js。如何為這些編譯時任務設置 Node 目錄?具體任務是:app:recordFilesBeforeBundleCommandDebug以及相關(guān)的錯誤: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 directoryCaused by: java.io.IOException: error=2, No such file or directory
3 回答

森林海
TA貢獻2011條經(jīng)驗 獲得超2個贊
我在 MacOS 上運行 Android Studio,以下對我有用:Yoruba's answer above and starts the application from Terminal with open -a "Android Studio.app"

暮色呼如
TA貢獻1853條經(jīng)驗 獲得超9個贊
如果您使用 React-Native,請將其添加到 build.gradle
ext {
react = [
nodeExecutableAndArgs: ["/usr/local/bin/node"]
]
}

蕪湖不蕪
TA貢獻1796條經(jīng)驗 獲得超7個贊
這是環(huán)境的已知錯誤:
蘋果芯片M1
Android Studio 北極狐 2020.3.1 補丁 3
在 gradle-wrapper.properties 中升級到 Gradle 6.9 或更高版本
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip
https://docs.gradle.org/6.9/release-notes.html
添加回答
舉報
0/150
提交
取消