Teamcity newman 未被识别为内部或外部命令

Teamcity newman is not recognized as an internal or external command

我正在尝试 运行 在 Teamcity 服务器上进行邮递员测试。我按照这个 link 进行设置 https://medium.com/@vdespa/how-to-run-postman-newman-tests-in-teamcity-9d767c7de542 虽然我安装了node、npm和newman -g。当我从 TeamCity 命令行构建步骤 运行 时,它无法识别 newman 命令

正如您在第 2 步中看到的那样,我只是 运行 正在执行命令 $ newman --version ,但它以代码 0 退出。可能无法找到 newman 所在的位置安装?我也试过这个 $setx /M PATH %AppData%\npm 但还是不行

任何帮助将不胜感激? @Valentin Despa

我可以通过在 C:\npm 文件夹而不是任何系统文件夹下安装 newman 来解决问题。同样在我没有将 npm Config 重置为默认值之前,这次我这样做了。我现在可以 运行 我的测试了。

在teamcity服务器上安装nodejs、npm和newman的详细步骤

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