npm:执行测试用例时在 gitlab-ci.yml 文件中未找到错误

Har*_*tel 3 javascript node.js gitlab gitlab-ci

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

这是我的 gitlab-ci.yml

test:
  type: test
  script:
    - npm run test
Run Code Online (Sandbox Code Playgroud)

执行 CI/CD 时出现此错误

/bin/sh: eval: 第 117 行: npm: 未找到

如何解决这个错误?

Avr*_*ham 7

您应该指定您要使用该node图像

test:
  image: node:10
  type: test
  script:
    - npm run test
Run Code Online (Sandbox Code Playgroud)