Issue
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:
- C:\Users\waniijag\AppData\Roaming\npm got added in the User variables for the user in the Environment variables
- 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.
Solution
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
Answered By - PDHide
Answer Checked By - Marie Seifert (JavaFixing Admin)