1

I'm using newman in Jenkins for executing the postman collection.

A brief background: I have installed node js in C:\Program Files\nodejs and newman was installed using globally so it got installed over here- C:\Users\waniijag\AppData\Roaming\npm\node_modules\newman

About the environment variables:

  1. C:\Users\waniijag\AppData\Roaming\npm got added in the User variables for the user in the Environment variables
  2. Also, I have appended C:\Program Files\nodejs in the Path variable of User variables for user and System variables both.

Now when I'm executing- "newman run Postman collection" OR C:\Users\waniijag\AppData\Roaming\npm\node_modules\newman run postman collection, I'm getting the error as:

'C:\Users\waniijag\AppData\Roaming\npm\node_modules\newman' is not recognized as an internal or external command,
operable program or batch file.

I'm not understanding where I'm going wrong- Thanks in advance.

Jagruuti
  • 104
  • 2
  • 14

1 Answers1

3

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

PDHide
  • 18,113
  • 2
  • 31
  • 46
  • This is how newman has exactly got installed ```C:\Users\waniijag\AppData\Roaming\npm\node_modules\newman``` and inside the newman folder, I have bin and the node_modules folder So, you are saying about which bin folder? ```C:\Users\waniijag\AppData\Roaming\npm\node_modules\newman\bin ```or ```C:\Users\waniijag\AppData\Roaming\npm\node_modules\newman\node_modules\.bin```? – Jagruuti May 09 '21 at 10:37
  • I appended the ```C:\Users\waniijag\AppData\Roaming\npm\node_modules\newman\node_modules\.bin``` in the Path variable of System variables of environment variables. It still did not work. – Jagruuti May 09 '21 at 10:51
  • @Jagruuti see the updted answer – PDHide May 09 '21 at 14:55
  • That is already added in both the Path variables of System variables and User variables of Environment. Is it that adding the path in both the variables will create confusion? If yes, then which one should I prefer? Or is the issue somewhere else? – Jagruuti May 09 '21 at 15:50
  • @Jagruuti are you able to see that files ? – PDHide May 09 '21 at 15:53
  • 2
    "C:\Users\someuser\AppData\Roaming\npm\newman" run , imagining that newman.cmd is in npm folder , use this command – PDHide May 09 '21 at 15:55
  • @PDHide- Yes, I'm able to see those files. – Jagruuti May 10 '21 at 14:13
  • Wow @PDHide, "C:\Users\someuser\AppData\Roaming\npm\newman" run worked. Thanks a lot :) – Jagruuti May 10 '21 at 14:18
  • 1
    @PDHide- Can you update the main answer also so that I can mark it as an answer? – Jagruuti May 10 '21 at 14:19