build - Electron 应用程序Travis CI构建失败

标签 build continuous-integration electron travis-ci xlib

我正在使用Electron使用javascript构建跨平台应用程序。我在使Travis CI成功构建时遇到了一些麻烦。

docs on setting it up说我的.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

这是一个构建日志(因为它很大,所以在pastebin中):https://pastebin.com/8N4P2S7Y。重要的部分如下:
> 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

关于build - Electron 应用程序Travis CI构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46006321/

相关文章:

java - "mvn clean install"与 "mvn install"有何不同?

python - 如何让setup.py安装多个顶级包?

android - 在 Mac OS X Lion 上构建 Android 4.0

continuous-integration - 用于持续集成的 VPS/VDS (TeamCity)

azure-devops - 如何在 Azure DevOps 中完成 PR 后自动触发构建

javascript - Electron :按住元键的同时拖动范围控制

c# - 在 Visual Studio 2013 中构建失败并显示 "Could not copy the file.. because it was not found"

php - 更有效地验证 PHP 文件的语法

google-chrome-devtools - 如何访问 Electron 应用程序当前的浏览器窗口?

javascript - 如何在 angular2 模板中使用 Electron 的 webview html 元素?