Description
Occasionally gradle node plugin fails to find npm.cmd file on windows 2016 server. It happens like 1 in 20 times or so. Now I know I can try download=true to let node plugin manage the complete lifecycle of npm however still wanted the problem to be registered incase somebody else faces it.
Node plugin config used
node {
workDir = file("$buildDir/node")
version = '7.4.0'
// Version of npm to use.
npmVersion = '4.0.5'
// try to use Node already on the local machine or docker container
download = false
// Set the work directory where node_modules should be located
nodeModulesDir = file("${project.projectDir}")
distBaseUrl = 'https://nodejs.org/dist'
}
node plugin used = id "com.moowork.node" version "1.2.0"
gradle version = 4.3.1 via gradlew wrapper
Exception trace:
[02:56:21][Step 1/1] * Exception is:
[02:56:21][Step 1/1] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':testing:npmSetup'.
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
[02:56:21][Step 1/1] 6 actionable tasks: 6 executed
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
[02:56:21][Step 1/1] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
[02:56:21][Step 1/1] at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
[02:56:21][Step 1/1] at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
[02:56:21][Step 1/1] at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
[02:56:21][Step 1/1] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
[02:56:21][Step 1/1] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
[02:56:21][Step 1/1] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
[02:56:21][Step 1/1] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
[02:56:21][Step 1/1] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
[02:56:21][Step 1/1] Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'npm.cmd''
[02:56:21][Step 1/1] at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:222)
[02:56:21][Step 1/1] at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:202)
[02:56:21][Step 1/1] at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:342)
[02:56:21][Step 1/1] at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
[02:56:21][Step 1/1] at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39)
[02:56:21][Step 1/1] ... 3 more
[02:56:21][Step 1/1] Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'npm.cmd'
[02:56:21][Step 1/1] at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
[02:56:21][Step 1/1] at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
[02:56:21][Step 1/1] at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
[02:56:21][Step 1/1] at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
[02:56:21][Step 1/1] ... 4 more
[02:56:21][Step 1/1] Caused by: java.io.IOException: Cannot run program "npm.cmd" (in directory "C:\BuildAgent\work\223b0bca6e7c3885\testing"): CreateProcess error=2, The system cannot find the file specified
[02:56:21][Step 1/1] at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
[02:56:21][Step 1/1] ... 7 more
[02:56:21][Step 1/1] Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
[02:56:21][Step 1/1] ... 8 more
Description Occasionally gradle node plugin fails to find npm.cmd file on windows 2016 server. It happens like 1 in 20 times or so. Now I know I can try download=true to let node plugin manage the complete lifecycle of npm however still wanted the problem to be registered incase somebody else faces it.
Node plugin config used
node plugin used = id "com.moowork.node" version "1.2.0" gradle version = 4.3.1 via gradlew wrapper
Exception trace: