'newman' is not recognized as an internal or external command in TeamCity Step Build

I am trying to run newman as command line script as step in Teamcity

I am following this example for my work

I am getting below error . Note . I already installed which available in C:\Users\kalai\AppData\Roaming\npm for my local machine .

I am able to run successfully below command from command line but not in inside teamcity build
newman run “https://www.getpostman.com/collections/8ea32a998d359102a156

‘newman’ is not recognized as an internal or external command,*

operable program or batch file.*

Process exited with code 1*

Process exited with code 1 (Step: Command Line)*

Could you please help to resolve this issue . Thank you for looking at this question

Hi @m.semalaiappan,

Welcome to the Postman community ! Just wanted to check with you whether you have installed newman after installing npm because although newman is part of the npm registry, you would have to go ahead and install newman on your machine using the following command:

npm install -g newman

I think the following documentation would be helpful: https://www.npmjs.com/package/newman

1 Like


I am trying to use self-hosted agent in Azure DevOps to run Postman tests. Due some restrictions to use extra tools, I am using command prompt to install and run newman under Microsoft Windows server based private agent.

My configuration in Azure DevOps pipeline

  1. Command line
    npm install -g newman
    -> Installation working fine

  2. Command line
    newman run …

What I am getting error is ‘‘newman’ is not recognized as an internal or external command,…’

The same tasks works fine with hosted agent. I suppose setting up the right path for newman is the problem. But I can’t make it solved with setting up global PATH or installing in local. Can you someone help me on this.


Btw, I followed these steps while setting up the tests under Azure DevOps: https://medium.com/@ganeshsirsi/how-to-configure-postman-newman-api-tests-in-azure-devops-or-tfs-and-publish-html-results-caf60a25c8b9

1 Like

I am having the same issue as shanchin2k

Hi @alessio.mazzone,

Welcome to the community. :wave:

Basically, the error message that you are seeing occurs when Windows is not able to find out where Newman is installed.

This can be fixed by adding the npm global install target directory to the system path, as below and this needs to be run in an administrative command prompt.

setx /M PATH %AppData%\npm

Thanks @suraj.purohit for the response. This is tested and works.

One question:
I see the NPM path is set based on currently logged in user’s path during this setx command run. It is problematic in our case since it should not point any real user’s folder since users can be removed and new users added. Can’t we set this some other way to point some user-independent folder? Any way to install the package in a user-independent folder?

Creating a separate user for this? Any other option to set other folder as installation path?