Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

NPM task failing

Matt Lupo August 16, 2017

I'm trying to set the Node JS capability in Bamboo 5.9.0 running on windows 2012 R2 server.  I installed Node JS/NPM on the server directly, and Bamboo detected the capability.  The build plan I'm currently running has a simple NPM task, and it's failing.  Running it on a local agent.  I have the Node JS 1.7.8 add on installed, but it does say it's incompatible.  Yet the server detects the capability.  Receiving the following error:

Error occurred while running Task 'Run CI Tests(2)' of type com.atlassian.bamboo.plugins.bamboo-nodejs-plugin:task.builder.npm.
error	15-Aug-2017 20:48:28	com.atlassian.bamboo.task.TaskException: Failed to execute task
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.plugins.nodejs.tasks.npm.NpmTaskType.execute(NpmTaskType.java:107)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.task.TaskExecutorImpl$3.call(TaskExecutorImpl.java:288)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.task.TaskExecutorImpl$3.call(TaskExecutorImpl.java:284)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:200)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:284)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:106)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:75)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:196)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:122)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:114)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:215)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:113)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:118)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
error	15-Aug-2017 20:48:28		at java.lang.Thread.run(Thread.java:745)
error	15-Aug-2017 20:48:28	Caused by: java.lang.IllegalArgumentException: The working directory must exist before executing the process
error	15-Aug-2017 20:48:28		at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.process.ProcessServiceImpl.createExternalProcess(ProcessServiceImpl.java:166)
error	15-Aug-2017 20:48:28		at com.atlassian.bamboo.process.ProcessServiceImpl.executeExternalProcess(ProcessServiceImpl.java:213)
error	15-Aug-2017 20:48:28		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
error	15-Aug-2017 20:48:28		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
error	15-Aug-2017 20:48:28		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error	15-Aug-2017 20:48:28		at java.lang.reflect.Method.invoke(Method.java:606)
error	15-Aug-2017 20:48:28		at 

 

1 answer

1 vote
Jeyanthan I
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 16, 2017

 Looking at the error, the npm task is telling us that the directories does not exist.

Caused by: java.lang.IllegalArgumentException: The working directory must exist before executing the process

You may have to add a script task to create directories before running npm install task runs.

Also, are you able to run npm install via command line successfully?

That said, Bamboo 5.9 is quite outdated and you should consider upgrading to the latest version.

 
Matt Lupo August 16, 2017

Thanks for the response.  I ran 'npm install' in command prompt under the folder that has nodejs.exe.  I've attached an image of what it displayed.  It looks like it ran, but gave an unable to find package.json message, along with a few othersnpminstall.png

Matt Lupo August 16, 2017

I plan on upgrading from 5.9 soon, just verifying compatibility with what we're using bamboo for. 

Matt Lupo August 17, 2017

Ok, I was able to run npm install and the npm run testci command successfully from the command line itself.  I can create a batch file that runs 'start cmd' and 'npm run testci' as a script task as well.  It looks like it's doing everything it's supposed to in the log, but the build never finishes. 

As for setting a specific npm task in bamboo, I still get the same error as I listed initially, even if I set the sub directory to the build directory containing package.json.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events