travis:sh:0:无法打开/etc/init.d/xvfb

问题描述 投票:2回答:1

我的travis CI使用Ubuntu 14.04和Node.js 8.我的.travis.yml看起来像:

language: node_js
node_js:
  - 8
sudo: required
addons:
    chrome: stable
before_script:
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
install:
  - npm set progress=false
  - npm install
script:
  - ng lint
  - npm run test
  - npm run e2e
  - npm run build

我试图更新它以使用Ubuntu 16.04和Node.js 10将其更改为:

language: node_js
node_js:
  - '10'
dist: xenial
sudo: required
addons:
    chrome: stable
before_script:
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
install:
  - npm set progress=false
  - npm install
script:
  - ng lint
  - npm run test
  - npm run e2e
  - npm run build

但是现在我在尝试启动xvfb时遇到错误:

0.00s $ sh -e /etc/init.d/xvfb start

sh:0:无法打开/etc/init.d/xvfb

命令“sh -e /etc/init.d/xvfb start”失败并在127期间退出。

node.js continuous-integration ubuntu-16.04 travis-ci
1个回答
4
投票

解决方案是从sh -e /etc/init.d/xvfb start阵列中移除before_script并简单地在xvfb阵列中引入services

所以我的.travis.yml现在看起来像这样:

language: node_js
node_js:
  - '10'
dist: xenial
sudo: required
services:
  - xvfb
addons:
    chrome: stable
before_script:
  - export DISPLAY=:99.0
install:
  - npm set progress=false
  - npm install
script:
  - ng lint
  - npm run test
  - npm run e2e
  - npm run build
© www.soinside.com 2019 - 2024. All rights reserved.