无法 运行 处理 npm 安装:找不到文件

Cannot run process npm install : file not found

我正在尝试在 TeamCity 服务器中构建一个项目。唯一的构建步骤是 运行 npm install

为此,我创建了以下构建步骤:

运行输入:命令行

步骤名称:安装

运行: 可带参数执行

命令可执行文件: npm install

命令参数:none

此命令出现以下错误:

[15:51:51] Step 1/1: Install (Command Line)

[15:51:51] [Step 1/1] Starting: npm install

[15:51:51] [Step 1/1] in directory: /path/to/repo/TeamCity/buildAgent/work/26cbe246a44af5d8

[15:51:51] [Step 1/1] Cannot run process npm install : file not found

[15:51:51] [Step 1/1] Step Install (Command Line) failed with unexpected error

[15:51:52] Publishing internal artifacts

[15:51:52] [Publishing internal artifacts] Publishing 1 file using [WebPublisher]

[15:51:52] [Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher] [15:51:52] Build finished

为什么我的构建代理不能 运行 一个简单的 npm install

执行 npm 的输出是什么?您是否将其安装在 运行 构建的代理中?

它试图找到 npm install 命令而不是 npm

所以,我将 install 设置为命令参数而不是命令本身,如下所示:

命令可执行文件: npm

命令参数:安装

...成功了