# ERROR npm ERR! errno 126, when running postman collections using maven in Jenkins

**URL:** <https://community.postman.com/t/error-npm-err-errno-126-when-running-postman-collections-using-maven-in-jenkins/16864>\
**Category:** Help Hub\
**Tags:** collections, jenkins, npm, maven\
**Created:** [October 17, 2020, 8:24pm UTC](https://community.postman.com/t/error-npm-err-errno-126-when-running-postman-collections-using-maven-in-jenkins/16864 "2020-10-17T20:24:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oasis](https://avatars.discourse-cdn.com/v4/letter/o/a698b9/32.png) [@oasis](https://community.postman.com/u/oasis)\
**Post date:** [October 17, 2020, 8:24pm UTC](https://community.postman.com/t/error-npm-err-errno-126-when-running-postman-collections-using-maven-in-jenkins/16864/1 "2020-10-17T20:24:36Z")

</div>

\*I am trying to run postman collections using Maven in Jenkins. I get below errors when the pipeline is run. I can run these locally with ‘mvn clean verify’ in intellij and all tests run successfully. Our company started using Postman recently and I am bit lost as how to solve this issue and looking for some help.:-

```auto
[INFO] --- frontend-maven-plugin:1.6:npm (merge) @ ihtests ---
[INFO] Running 'npm run shipment-tests' in /var/jenkins/workspace/com.tcel_intests_merge/temp
[INFO] 
[INFO] > postman-newman-jenkins@1.0.0 shipment-tests /var/jenkins/workspace/com.trakcel_ihtests_merge/temp
[INFO] > newman run test/postmancollection/AcceptValidRequest.postman_collection.json -e test/PostmanEnv/Test.postman_environment.json --reporters cli,junit --reporter-junit-export newman.xml
[INFO] 
[ERROR] sh: /var/jenkins/workspace/com.tcel_intests_merge/temp/node_modules/.bin/newman: Permission denied
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 126
[ERROR] npm ERR! postman-newman-jenkins@1.0.0 shipment-tests: `newman run test/postmancollection/AcceptValidRequest.postman_collection.json -e test/PostmanEnv/Test.postman_environment.json --reporters cli,junit --reporter-junit-export newman.xml`
[ERROR] npm ERR! Exit status 126
[ERROR] npm ERR! 
[ERROR] npm ERR! Failed at the postman-newman-jenkins@1.0.0 shipment-tests script.

```

POM:-

```auto
<profiles>
        <profile>
            <id>merge</id>
        </profile>
    </profiles>

    <build>

        <plugins>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.6</version>
                <configuration>
                    <workingDirectory>.</workingDirectory>
                    <!-- where to install npm -->
                    <installDirectory>.</installDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v10.15.3</nodeVersion>
                            <npmVersion>6.14.8</npmVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <!-- Optional configuration which provides for running any npm command -->
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>merge</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>
                                **run shipment-tests**
                            </arguments>
                        </configuration>
                        <phase>generate-resources</phase>
                    </execution>
                </executions>

            </plugin>
        </plugins>
    </build>

```

Package.json:-

```auto
{
  "name": "postman-newman-jenkins",
  "version": "1.0.0",
  "description": "Project for storing postman tests",
  "main": "index.js",
  "directories": {
    "tests": "test/postmancollection"
  },
  "scripts": {

    "shipment-tests": "newman run test/postmancollection/AcceptValidRequest.postman_collection.json -e test/PostmanEnv/Test.postman_environment.json --reporters cli,junit --reporter-junit-export newman.xml"
  },
  "repository": {
    "type": "git",
    "url": "git@gitlab.dev.com:test-automation/intests.git"
  },
  "author": "JJ",
  "dependencies": {
    "newman": "^5.2.0",
    "npm": "^6.14.8"
  }
}

```

Pipeline:-

```auto
pipeline {
  agent {label '!master'}

   }
    stages {
        stage('Run ih api tests') {
            steps {
                sh 'mvn clean verify -P merge'

            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [October 20, 2020, 7:25pm UTC](https://community.postman.com/t/error-npm-err-errno-126-when-running-postman-collections-using-maven-in-jenkins/16864/2 "2020-10-20T19:25:28Z")

</div>

It seems that you are getting a permission denied error.

> [ERROR] sh: /var/jenkins/workspace/com.tcel\_intests\_merge/temp/node\_modules/.bin/newman: Permission denied

Make sure newman has the right permissions to run with the Jenkins user.

---

<div class="post-metadata">

**Author:** ![oasis](https://avatars.discourse-cdn.com/v4/letter/o/a698b9/32.png) [@oasis](https://community.postman.com/u/oasis)\
**Post date:** [October 21, 2020, 10:55am UTC](https://community.postman.com/t/error-npm-err-errno-126-when-running-postman-collections-using-maven-in-jenkins/16864/3 "2020-10-21T10:55:09Z")

</div>

@vdespa, Thanks. Can I ask how to do that. Sorry being silly. I have tried the below:-  
pipeline {  
agent {  
docker {  
image ‘node:10-alpine’  
args ‘-p 3000:3000 -p 5000:5000’  
args ‘-u 0:0’

```
        }
    }

    stages {
        stage('Run ih api tests') {
            steps {

                        // sh 'sudo chown root:jenkins /var'
                        sh 'sudo usermod -a -G docker jenkins'
                        sh 'mvn clean verify -P merge'
            }
        }
        }

    }
```

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [October 24, 2020, 8:29pm UTC](https://community.postman.com/t/error-npm-err-errno-126-when-running-postman-collections-using-maven-in-jenkins/16864/4 "2020-10-24T20:29:28Z")

</div>

Are you using Docker for running Newman? It seems that you now have a different setup.
