Cannot run newman on Jenkins on Windows

Hi,
I had installed newman using the npm in command prompt. I wanted to execute the collections using Jenkins, so I tried using the newman command and I got an error during the build saying newman not found. I tried giving the path as shown in the image.

But that newman folder got created when I tried generating the reports. I wanted to know where can I find the source path of Newman if I have installed newman using npm and cmd.

Thanks in Advance.

@jagrutiwani0, since your error messages are related to newman, I am just throwing some wild guesses. I haven’t integrated Postman with Jenkins :blush:

try checking the version of npm installed, using the command “newman -version”.
And you can try uninstalling and install newman again.

2 Likes

Hi @jagrutiwani0,

jenkins should recognize the newman for that you have to do the below setup in jenkins

Manage Jenkins->Configure System->Gloabl Properties - set Nodejs path and newman path

Project Configure->Build Environment - Provide Node & npm bin/ folder to PATH

image

then use newman command to run -
newman run “C:\Users\abc\Desktop\Postman-newman\postman_collection.json”

OR

you can directly pass this command as a windows batch command in jenkins to run collections using newman

C:\Users\abc\AppData\Roaming\npm\newman run “C:\Users\abc\Desktop\Postman-newman\Chaining.postman_collection.json”

2 Likes

Hi,
I uninstalled the complete nodejs itself. I thought that newman will also get uninstall along with it. But it didn’t because when I installed nodejs again and checked the version of newman, it was already there. But I didn’t find the folder for newman in the npm folder. Where I’m going wrong?

Note : Previously I had installed Newman using npm install -g newman.

Hi,

There is no option for Provide Node & npm bin/ folder to PATH in the Build Evironment

I’m still getting the same issue:

Edit: I installed the nodejs plugin:
After that, there is no option in the dropdown.
image

no drop down you have to setup some name like what I set,

did try passing this command directly

C:\Users\abc\AppData\Roaming\npm\newman run “C:\Users\abc\Desktop\Postman-newman\Chaining.postman_collection.json

After clicking on apply, I’m getting the below error.

Edit: This issue got solved after implementing > This solution is SAFE to use

came along this issue when we changed jenkins to be accessible via reverse proxy.

There is an option in the " Configure Global Security " that " Enable proxy compatibility " This helped with my issue. from > This solution is SAFE to use
from

I’m still getting the same issue even after following as you have said.

Hello,

This issue has been solved. Please find the below link for reference- node.js - Newman is not recognised as an internal or external command in Jenkins on Windows 10 - Stack Overflow

Thank you @sseenivasan89 and @bpricilla for your help :slight_smile:

1 Like

enter image description here

add that directory that contains this file, to your environment variable. it will be present in either of:

C:\Users\waniijag\AppData\Roaming\npm\node_modules\.bin

or

C:\Users\waniijag\AppData\Roaming\npm

or directly run it as :

 "C:\Users\someuser\AppData\Roaming\npm\newman" run 

, imagining that newman.cmd is in npm folder , use this command

1 Like

i had same issue and you can find solution in this video