npm 安装后 Gitlab runner 停止
Gitlab runner stop after npm install
为了在 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 安装,但到此结束。它不会继续到第二个脚本(就像它出于某种原因忽略它一样)。
这是输出:
可能是什么原因造成的?
我仍然没有找到发生这种情况的原因,但是作为 解决方法 经过长时间的搜索而不是使用 ng test
,我正在使用 [=12] =], 像那样:
TestIt:
script:
- npm test
在
Karma.config.js
我从 autoWatch: true
更改为 false
,从 singleRun: false
更改为 true
以防止连续测试。
我拿出了- npm install
如果您在 windows,您可能 运行 遇到了这个问题(在 "npm" 命令后没有执行其他操作):
https://gitlab.com/gitlab-org/gitlab-runner/issues/2730
TL;DR: 使用 call npm install
而不是 npm install
,那么第二个命令也会执行。缺点:那么您的 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 安装,但到此结束。它不会继续到第二个脚本(就像它出于某种原因忽略它一样)。
这是输出:
可能是什么原因造成的?
我仍然没有找到发生这种情况的原因,但是作为 解决方法 经过长时间的搜索而不是使用 ng test
,我正在使用 [=12] =], 像那样:
TestIt:
script:
- npm test
在
Karma.config.js
我从 autoWatch: true
更改为 false
,从 singleRun: false
更改为 true
以防止连续测试。
我拿出了- npm install
如果您在 windows,您可能 运行 遇到了这个问题(在 "npm" 命令后没有执行其他操作):
https://gitlab.com/gitlab-org/gitlab-runner/issues/2730
TL;DR: 使用 call npm install
而不是 npm install
,那么第二个命令也会执行。缺点:那么您的 CI 配置不再与平台无关。