Azure管道中无法运行NPX命令

4

我需要你的帮助 我想运行我的Cypress测试用例,通常使用命令"npx cypress run"来运行。 当我在创建 Azure 管道时尝试使用相同的命令,结果出现了以下问题:

在 NPM 安装后,我甚至尝试通过 npm 任务和自定义命令 "npm install nx" 安装 npx,但这导致出现以下问题,请问有人能告诉我该如何处理吗?

"##[warning]Couldn't find a debug log in the cache or working directory

##[error]Error: Npm failed with return code: 1 "

enter image description here


1
你的管道已经提供了 npm 吗?错误信息看起来像是传递了 npm npm install nx,这让我相信有一个不必要的 npm 被添加了进去。如果你正在指定 npm install nx,你可以尝试执行 install nx - agoff
1个回答

2

从错误截图中可以看出,您正在使用Npm任务并运行命令:npm npm install nx

该命令是无效的。

要解决此问题,您需要在NPM任务 -> 命令和参数中删除npm

请参考以下示例:

YAML管道:

- task: Npm@1
  displayName: 'npm custom'
  inputs:
    command: custom
    verbose: false
    customCommand: 'install nx'

传统的流水线:

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接