Trying to run my postman collection in azure devops inside a self-hosted agent. When I try to run the command inside the agent "newman run postman_collection.json -e postman_environment.json -r cli,htmlextra" it's running fine. But when I run the same through a a command line script task in release pipeline it's throwing the error "newman is not recognized..". I also tried to have a npm task for newman installation i.e. "npm install -g newman" it's also throwing the erro "##[error]Unable to locate executable file: 'newman'. Please verify either the file path exists or the file can be found within a d...."
Asked
Active
Viewed 297 times
1 Answers
0
azure devop selfhosted agent, newman command not recognized
According to the error message "##[error]Unable to locate executable file: 'newman" when you using the npm install -g newman
, you could try to add C:\Users\[BUILDSERVER-USERNAME]\AppData\Roaming\npm
to the PATH variable for the [BUILDSERVER-USERNAME]
user.
You could refer to this document How to fix the Newman task for Team Foundation Server silently failing for some more details.
Besides, when we use command line to install the newman, it will take a few minutes to install it, so we need to wait for a few minutes before we using the command line:
"newman run postman_collection.json -e postman_environment.json -r cli,htmlextra"
You could add powershell task to sleep a few minutes:
echo "Sleeping for 10 mins..."
Start-Sleep -s 600

Leo Liu
- 71,098
- 10
- 114
- 135
-
Thanks for the replies, I found the answer, the command prompt window that run the agent is not run as Administrator that's the reason it was not able to execute the newman command – Stephen Jose Aug 16 '22 at 19:28