Search code examples
postmanteamcitynewman

Teamcity newman is not recognized as an internal or external command


I am trying to run postman tests on Teamcity server. I followed this link for setup https://medium.com/@vdespa/how-to-run-postman-newman-tests-in-teamcity-9d767c7de542 Although I have installed node, npm and newman -g. When I run from TeamCity Command line build step it doesn't recognize newman command

Shows that I have newman installed

Teamcity build CLI error

As you can see in the step 2, I am just running the command $ newman --version ,but it is exited with code 0. Probably, it is not able to find where newman is installed? I also tried this $setx /M PATH %AppData%\npm but still doesn't work

Any help would be appreciated? @Valentin Despa


Solution

  • I was able to resolve the issue by installing newman in C:\npm folder instead of under any system folder. Also before I wasn't resetting the npm Config to default which I did this time. I am able to run my tests now.

    Detailed Steps to install nodejs, npm and newman on teamcity server

    Login to TeamCity Server
    
    Download the Nodejs
    
    Install Nodejs (C:\ProgramFiles\nodejs)
    
    Open Command prompt as run as Administrator
    
    type node -v (should return node version)
    
    type npm - v (should return npm version)
    
    type npm prefix -g (usually it defaults to user folder and returns
    C:\Users\user1\AppData\Roaming\npm )
    
    Note the current global prefix
    
    Set the global prefix to by running this on cmd: npm config set prefix C:\npm
    
    Install the needed packages by running this on cmd: npm install -g newman
    
    Restore the prefix to the previous value by running this on cmd: npm config set prefix C:\Users\user1\AppData\Roaming\npm
    
    Open System Environment variables
    
    Edit environment variables and make sure this added to Path: C:\npm
    
    Also additionally you can check under user variables for user1 Path
    is set to for npm: C:\Users\user1\AppData\Roaming\npm
    
    Now restart the windows server machine
    
    After that, from the Teamcity web interface, restart the teamcity
    server
    
    You should have running newman on your teamcity server on cmd prompt as well as build steps