# NPM Issue while running from jenkins

**URL:** https://discuss.gradle.org/t/npm-issue-while-running-from-jenkins/25009
**Category:** Help/Discuss
**Created:** [December 5, 2017, 7:35am UTC](https://discuss.gradle.org/t/npm-issue-while-running-from-jenkins/25009 "2017-12-05T07:35:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vinay\_a\_verma](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vinay_a_verma/32/6156_2.png) [@vinay\_a\_verma](https://discuss.gradle.org/u/vinay_a_verma)
#### Post date: [December 5, 2017, 7:35am UTC](https://discuss.gradle.org/t/npm-issue-while-running-from-jenkins/25009/1 "2017-12-05T07:35:50Z")

</div>

I am currently facing some issue which are related to gradle/NodeJS. What I did is used Node plugin by writing this in my gradle script:

```
apply plugin: 'com.moowork.node'

dependencies {
	classpath 'com.moowork.gradle:gradle-node-plugin:0.12'
 }

```

now when I try to run install npm command from terminal(CentOS) by running:

```
gradle npmInstall

```

it is running perfectly fine and installing all the required packages whereas when I run the same command from Jenkins (Jenkins installed in centos), I am getting following error msg:

```
:npmInstall FAILED
 FAILURE: Build failed with an exception.

* What went wrong:
  Execution failed for task ':npmInstall'.
  > A problem occurred starting process 'command 'npm''

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task 
':npmInstall'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)

Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'npm''
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:197)

Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'npm'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)

```

Can somebody please help me with is. I am not getting what Wrong I am doing.  
I am also getting the same error msg if try to run following command:

```
gradle npm_run_build_prod 

```

whereas the same list of commands are working for my local windows jenkins.

---

<div class="post-metadata">

### Author: ![jjustinic](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jjustinic/32/9005_2.png) [@jjustinic](https://discuss.gradle.org/u/jjustinic)
#### Post date: [December 5, 2017, 4:52pm UTC](https://discuss.gradle.org/t/npm-issue-while-running-from-jenkins/25009/2 "2017-12-05T16:52:51Z")

</div>

You can receive that error if the `npm` command is not available on the `PATH`. The user running Jenkins on CentOS might have a reduced path. By default, the plugin will not download NodeJS/NPM unless you add:

```gradle
node {
    download = true
}

```

Otherwise, it is expected that Node is installed and `npm` is available on the path.

---

<div class="post-metadata">

### Author: ![vinay\_a\_verma](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vinay_a_verma/32/6156_2.png) [@vinay\_a\_verma](https://discuss.gradle.org/u/vinay_a_verma)
#### Post date: [December 6, 2017, 7:58am UTC](https://discuss.gradle.org/t/npm-issue-while-running-from-jenkins/25009/3 "2017-12-06T07:58:20Z")

</div>

Thanks James!

Your suggestion resolved my issue I just additionally mentioned the version like this:

```
node {
    download = true
    version='9.2.0'
}

```

and it worked.  
Thanks Again 🙂
