javascript - 执行测试用例时npm : not found error in gitlab-ci. yml文件

标签 javascript node.js gitlab gitlab-ci

我正在尝试测试我的nodeJs 测试用例。

这是我的 gitlab-ci.yml

test:
  type: test
  script:
    - npm run test

执行 CI/CD 时出现此错误

/bin/sh: eval: line 117: npm: not found

如何解决这个错误?

最佳答案

您应该指定要使用 Node 图像

test:
  image: node:10
  type: test
  script:
    - npm run test

关于javascript - 执行测试用例时npm : not found error in gitlab-ci. yml文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55158241/

相关文章:

node.js - 使用 Gitlab Runner 部署到 Digital Ocean 时出现 "docker pull"需要恰好 1 个参数错误

regex - 神交 - 如何获得 URIPATHPARAM?

javascript - 需要帮助查找 javascript 代码

javascript - 我得到一个函数A和函数C。函数B在函数中

javascript - 如何在 ul 中禁用或添加特定类?

mysql - 通过 Node 将 JSON-Object 传递到 MYSQL 列

javascript - 根据点击次数更改按钮的文本

node.js - 无法在 Mongoose 中按 id 找到记录

node.js - 如何解决 MalformedResponse 'final_response' 必须设置。 Action 模拟器错误

gitlab - 更改默认的 Gitlab 端口