【问题标题】:Npm exited with code '1' - try to run cypress tests in azure devopsNpm 以代码“1”退出 - 尝试在 azure devops 中运行 cypress 测试
【发布时间】:2020-11-16 19:23:52
【问题描述】:

我尝试在 azure devops 中运行 cypress 测试。当尝试使用 npm 任务时,我收到如下错误:

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT

我的问题是这是什么意思?我应该在哪里搜索原因?每次我使用下面的 npm 任务时都会收到这些错误。 Git 已安装在设备中。添加路径。

      - task: Npm@1
        displayName: "npm install"
        inputs:
          command: 'install'                  
          workingDir: '$(System.SomeArtifact)/drop/SomeDirWithPackageJson'
      - task: Npm@1
        displayName: "run cy:run"
        inputs:
          command: 'custom'
          workingDir: '$(System.SomeArtifact)/drop/SomeDirWithPackageJson'
          customCommand: 'run cy:run'

【问题讨论】:

  • 错误来自npm install或run cy:run?

标签: azure npm azure-devops yaml


【解决方案1】:
npm ERR! syscall spawn git

这样的错误消息通常意味着 git 配置不正确或未安装。确保将 git 添加到您的 PATH 中。这是一个ticket,应该可以帮助您进行设置。

如果安装了 git,在 cmd 'git --version' 中输入这个命令,如果它返回任何版本,你就可以了。

另外,您可以检查安装的git是否只能从Git Bash访问,如果是,则需要使用第二个选项重新安装。

这里有一些票证(case1,case2)有同样的错误,你可以参考一下。

【讨论】:

  • 我已经在我的设备中安装了 git。这就是为什么我不明白为什么这些错误仍然发生。我也需要在管道中安装 git 吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-01-01
  • 1970-01-01
  • 2021-11-21
  • 2021-11-18
  • 2023-02-26
  • 2015-03-05
  • 1970-01-01
相关资源
最近更新 更多