我有一个测试套件,可以在本地设置上完美运行,这是库:https://github.com/IbrahimTanyalcin/RafX
但是我无法在Travis CI上使用它,但我不断得到:“未下载Chromium版本”
这是我的yml文件:https://github.com/IbrahimTanyalcin/RafX/blob/master/.travis.yml
language: node_js
dist: trusty
addons:
apt:
packages:
# This is required to run new chrome on old trusty
- libnss3
notifications:
email: false
cache:
directories:
- node_modules
sudo: required
node_js:
- "12.13.0"
env:
#global:
# - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=0
# allow headful tests
before_install:
# Enable user namespace cloning
- "sysctl kernel.unprivileged_userns_clone=1"
# Launch XVFB
- "export DISPLAY=:99.0"
# - export CHROME_PATH="$(pwd)/chrome-linux/chrome"
- "sh -e /etc/init.d/xvfb start"
# wait for xvfb to boot
- sleep 3
# start your web application and listen on `localhost`
# - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
install:
- npm install
- npm install -g puppeteer --unsafe-perm=true --allow-root
# - yarn add --dev jest-puppeteer
# - yarn add puppeteer
script:
- npm run testCI
这是失败的版本https://travis-ci.org/IbrahimTanyalcin/RafX
[我注释掉了我尝试过的一些选项,我几乎到处都检查过,包括操纵up和玩笑的文档,并实际上采用了他们推荐的yml文件。
我也尝试在此线程中应用建议,但无济于事:https://github.com/puppeteer/puppeteer/issues/2173
知道如何解决这个问题?
对于任何为此感到苦恼的人,似乎我已经在您的before install
中找到了解决方法:
before_install:
- node node_modules/puppeteer/install.js
如果添加这些行,您是在手动调用节点来安装puppeteer,但我不知道npm install
为何失败,但这似乎可以解决问题。