Build Electron应用程序Travis CI构建失败

Build Electron应用程序Travis CI构建失败,build,continuous-integration,electron,travis-ci,xlib,Build,Continuous Integration,Electron,Travis Ci,Xlib,我正在使用Electron使用javascript构建一个跨平台应用程序。但是我在让Travis CI成功构建方面遇到了一些困难 我的.travis.yml应该与以下内容类似: addons: apt: packages: - xvfb install: - export DISPLAY=':99.0' - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & 我当前的.travis.y

我正在使用Electron使用javascript构建一个跨平台应用程序。但是我在让Travis CI成功构建方面遇到了一些困难

我的
.travis.yml
应该与以下内容类似:

addons:
  apt:
    packages:
      - xvfb

install:
  - export DISPLAY=':99.0'
  - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
我当前的
.travis.yml
如下所示:

language: node_js

node_js:
  - "node"

addons:
  apt:
    packages:
      - xvfb

before_install:
  - cd src/

install:
  - npm install

before_script:
  - export DISPLAY=':99.0'
  - Xvfb :99 -screen 0 1024x768x24 +extension GLX +extension RANDR > /dev/null 2>&1 &

script:
  - npm test
这是一个构建日志(在一个粘贴箱中,因为它很大):。重要部分如下:

> ThemeCreator@0.1.0 test /home/travis/build/blabel3/ThemeCreator/src
> electron .

Xlib:  extension "RANDR" missing on display ":99.0".
Xlib:  extension "RANDR" missing on display ":99.0".


No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

The build has been terminated

非常感谢你们能提供的任何帮助

应该可以只使用
sh-e/etc/init.d/xvfb start运行xvfb

目前我正在使用下面的配置,它工作正常

os:
  - linux

language: node_js

node_js:
  - "7.7"

before_script:
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=:99.0; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh -e /etc/init.d/xvfb start; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sleep 3; fi

script:
  - node --version
  - npm --version
  - npm install
  - npm run e2e

您还可以使用
xvfb run my_script
来减少一些设置。