I get the following error message when running 'react-native run-android', and cannot get more detailed information even with --stacktrace, --info or --debug options.
:app:recordFilesBeforeBundleCommandDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:recordFilesBeforeBundleCommandDebug'.
> A problem occurred starting process 'command 'node''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.042 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
Seems it cannot find node
in your path. Is your path setup correctly?
Yes of course. It succeeds, sometimes.
2016-04-17 5:02 GMT+08:00 Satyajit Sahoo [email protected]:
Seems it cannot find node in your path. Is your path setup correctly?
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/facebook/react-native/issues/6875#issuecomment-210901067
I've got the same issue. I don't think it's related to React Native or in this case Code Push, it's gradle not finding node
in the path. Putting the absolute path (/usr/local/bin/node
on install with Homebrew) fixes the issue for now, I'll try to find something perennial.
I've seen this too - similar to @anderson916 in that it's by no means 100% failing. My workaround is to run ./gradlew --stop (which stops the daemon)
@seeligd it works,thank you!
@seeligd you're the man
@seeligd Thank you. But Why?
Is this related to NVM perhaps? I'm definitely using NVM, and I've seen this issue as well.
Hi there! This issue is being closed because it has been inactive for a while.
But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/apprecordfilesbeforebundlecommanddebug-failed
Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top
Also, if this issue is a bug, please consider sending a pull request with a fix.
Hi! Still experiencing this issue right now, even after running ./gradlew --stop
as suggested multiple times. Any ideas?
By changing node executable path in build.gradle(app) works for me.
project.ext.react = [
nodeExecutableAndArgs : ["/usr/local/bin/node"]
];
@cskaynar good!
./gradlew --stop or simply you can close your Android Studio
Still experiencing this issue right now, even after running ./gradlew --stop as suggested multiple times.
My project is native with react native.
My Environment :
android studio : 3.0 beta
gradle plugin : 3.0.0-beta7
gradle wrapper: gradle-4.1-all.zip
Any ideas?
2017-10-27, I updated my android studio to 3.0 stable version , but still experiencing this issue.
Execution failed for task ':app:recordFilesBeforeBundleCommandOfficialDebug'.
A problem occurred starting process 'command 'node''
Stop daemon helps when gradle daemon not started from terminal. E.g. Android Studio launches with custom env variables.
@gtzh110 Did you ever resolve your issue? Running into the same issue myself and none of the other suggestions are working.
UPDATE: I reverted back to buildToolsVersion 25.0.0 and this error went away. It appears that in upgrading to Android Studio 3.0.0 and taking the suggestion to update buildTools to 26.0.2 seems to have caused the error.
I got the same error with buildTools to 26.0.2 and Android Studio 3.0.0 on Mac
I got the same error with buildTools to 26.0.2 and Android Studio 3.0.0 on Mac
I got the same error with buildTools to 26.0.2 and Android Studio 3.0.0 on Mac
@mkonicek could we reopen the issue?
I am seeing this as well with buildTools 26.0.2, Android Studio 3.0.0, and a Mac. Neither workaround above (./gradlew --stop
or setting nodeExecutableAndArgs
) helped for me. I have node available both at /usr/local/bin/node
and via nvm (i.e. ~/.nvm/versions/node/v6.9.1/bin/node
). Here's the output from ./gradlew --stacktrace
:
Error:10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:recordFilesBeforeBundleCommandDevDebug'.
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > A problem occurred starting process 'command 'node''
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:recordFilesBeforeBundleCommandDevDebug'.
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
10:08:13.068 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'node''
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:220)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:204)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:340)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] ... 3 more
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'node'
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] ... 4 more
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.io.IOException: Cannot run program "node" (in directory "/Users/jacob/triggr/triggr_native_android/app"): error=2, No such file or directory
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] ... 6 more
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.io.IOException: error=2, No such file or directory
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] ... 7 more
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
10:08:13.069 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 4s
And here are the relevant output lines from ./gradlew --debug
:
10:08:13.042 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Execute task action 2/2 for :app:recordFilesBeforeBundleCommandDevDebug' started
10:08:13.042 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'command 'node''. Working directory: /Users/jacob/triggr/triggr_native_android/app Command: node ../node_modules/react-native-code-push/scripts/recordFilesBeforeBundleCommand.js /Users/jacob/triggr/triggr_native_android/app/build/intermediates/res/merged/dev/debug
10:08:13.042 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Environment for process 'command 'node'': {PATH=/usr/bin:/bin:/usr/sbin:/sbin, SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.njnCUxFlBS/Listeners, SHELL=/bin/bash, XPC_FLAGS=0x0, __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0, Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.d80ZuEwunz/Render, LOGNAME=jacob, XPC_SERVICE_NAME=com.google.android.studio.22720, USER=jacob, HOME=/Users/jacob, TMPDIR=/var/folders/dr/7f0vd5pj4yj020yp10fbg8d80000gn/T/}
10:08:13.042 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
10:08:13.043 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command 'node'.
10:08:13.058 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
10:08:13.058 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command 'node'' finished with exit value -1 (state: FAILED)
10:08:13.058 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Execute task action 2/2 for :app:recordFilesBeforeBundleCommandDevDebug'
What's relevant there is that $PATH
does not include /usr/local/bin, which is surprising and probably wrong.
@cskaynar's solution is the correct one. Downgrading from 26 to 25 is a bandaid.
You can also specify your node executable at your _root_ build.gradle
so that it applies to all sub projects, which makes sense:
ext {
react = [
nodeExecutableAndArgs: ["/usr/local/bin/node"]
]
}
To find out where your node executable is located, run which node
from the terminal and replace /usr/local/bin/node
with whatever the result is.
That's a fine workaround, although it's perhaps not workable in a team environment where the node path isn't necessarily known. But there's an actual bug here, too, where commands are being run with a bogus $PATH
.
@artdent You're 💯 right.
@artdent did u already fix the problem ? i got the same issue too ,and i dont know how to fix it
Also having the same issue after upgrading Android studio.. please help can't build or release any android apps
@aliceathens Did you try specifying your node path, as instructed in https://github.com/facebook/react-native/issues/6875#issuecomment-345528431?
not working for
ext {
react = [
nodeExecutableAndArgs: ["/usr/local/bin/node"]
]
}
project.ext.react = [
nodeExecutableAndArgs : ["/usr/local/bin/node"]
];
Try starting AS from your shell
@a1018875550 Is that your correct node path?
If you don't want to limit config to specific os, you can something similar:
// Android studio bug hack
if (System.properties['os.name'].contains("Mac")) {
project.ext.react.nodeExecutableAndArgs = ["/usr/local/bin/node"]
}
This solution does not work for me. I've got the exact same config as the others using the latest version of studio.
@joshuapinter That version worked for me, thanks!
@joshuapinter tried as specified in comment #6875. Getting error
`Error:Execution failed for task ':madhuAndroid:recordFilesBeforeBundleCommandMadhuDebug'.
Process 'command '/usr/local/bin/node'' finished with non-zero exit value [1`]
@madhuA14 What is the result if you run which node
in your terminal?
@joshuapinterwhich node - /usr/local/bin/node
Here is my complete error log
Information:Gradle tasks [:madhuAndroid:assembleMadhuDebug]
Error:Cannot find module '/Users/madhua/madhu/node_modules/react-native-code-push/scripts/recordFilesBeforeBundleCommand.js'
Error:Execution failed for task ':madhuAndroid:recordFilesBeforeBundleCommandMadhuDebug'.
Process 'command '/usr/local/bin/node'' finished with non-zero exit value 1
@madhuA14 Sounds like a different error than this thread. This error is about the build not finding your node bin whereas your error seems to find it just fine but then runs into an error. I'd do a search for that error and see what you can find.
@cskaynar Thanks
Just create a symbolic link like so:
Step 1:
which node
In my case that printed out /usr/local/opt/nvm/versions/node/v8.4.0/bin/node
Step 2:
Then I did
ln -s /usr/local/opt/nvm/versions/node/v8.4.0/bin/node /usr/local/bin/node
and it now works.
If your node_modules
module path has been modified, so you need to react-native-code-push/android/codepush gradle
to nodeModulesPath
modified into corresponding node_modules
module path.
For me what worked is just restarting android studio, clean project, then run again.
Most helpful comment
I've seen this too - similar to @anderson916 in that it's by no means 100% failing. My workaround is to run ./gradlew --stop (which stops the daemon)