【发布时间】:2021-10-04 10:11:57
【问题描述】:
当我尝试使用命令 npm run test运行测试时,我尝试使用 gitlab-ci 和节点 docker 映像构建一个小型 Angular 应用程序> 它失败并出现以下错误:
ERROR [launcher]: No binary for Chrome browser on your platform. Please, set "CHROME_BIN" env variable.
gitlab-ci.yml
stages:
- build
variables:
NPM_CONFIG_REGISTRY: https://test.com/xx/api/npm/npm-all
build:
stage: build
image: node:12.9
script:
- npm install
- npm run build:prod
- npm run test
tags:
- DOCKER
在上面的代码中,npm run test 执行 ng test 按照 package.json 中的配置
我能够运行构建,但是当我运行测试时它会寻找 chrome 浏览器,我还尝试使用以下命令以无头方式运行测试,但导致相同的错误:
ng test --no-watch --browsers=ChromeHeadless
如何在此版本中添加 chrome 功能?
【问题讨论】:
标签: gitlab-ci docker-image angular-test