Npm安装后Gitlab运行器停止

时间:2017-10-25 14:20:30

标签: yaml gitlab gitlab-ci

为了在Gitlab中使用管道,我创建了以下.gitlab-ci.yml文件:

image: node:8.2.1

cache:
  paths:
    - node_modules/

TestIt:
  script:
    - npm install
    - '/node_modules/@angular/cli/bin/ng test --single-run=true --browsers PhantomJS --watch=false'

当跑步者开始工作时,它正在成功进行npm安装,但结束了。它不会继续第二个脚本(就像它因某种原因而忽略它)。

这是输出:

enter image description here

原因可能是什么?

2 个答案:

答案 0 :(得分:1)

我仍然没有找到发生这种情况的原因但是作为A 解决方法经过长时间搜索而不是使用ng test后,我正在使用npm test,就像那样:

TestIt:
  script:
    - npm test 

in

Karma.config.js

我从autoWatch: true更改为false,从singleRun: false更改为true,以防止持续测试。

我拿出- npm install

答案 1 :(得分:1)

如果你在Windows上,你可能会遇到这个问题(在" npm"命令之后没有其他任何事情执行):

https://gitlab.com/gitlab-org/gitlab-runner/issues/2730

TL; DR:使用call npm install代替npm install,然后第二个命令也会执行。缺点:那么您的CI配置不再是平台独立的。