Puppeteer fails on CircleCI

My 2.0 tests which run fine locally all fail on circleCI. Is this a known problem and if so, how do I work around it?

Probably not. Any form of Linux-based CI is really just a VPS with some extra tools installed. So, if something “fails on CI”, then essentially it is failing on a Linux VPS, and needs to be debugged.

What error are you getting? What base image are you using? Would you should readers your config.yml?

HI. Thanks for the response.

I believe the problem has to do with puppeteer having it’s own version of chromium to insure compatibility rather than using chrome in the docker. Thus the missing libraries in the error report.

The errors are, for each launch of puppeteer, this:
name: AssertionError
message: Rejected promise returned by test
values: {“Rejected promise returned by test.
Reason:”:“Error {\n message: Failed to launch chrome!␊\n /home/circleci/repo/node_modules/puppeteer/.local-chromium/linux-555668/chrome-linux/chrome: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory␊\n ␊\n ␊\n TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md␊\n,\n}”}
at: onClose (node_modules/puppeteer/lib/Launcher.js:255:14)

Here’s the config:

version: 2
  - image: circleci/node

working_directory: ~/repo

  - checkout

  - restore_cache:
        - v1-dependencies-{{ checksum "package.json" }}

  - run: yarn install

  - run: yarn build

  - run:
      command: mkdir -p ~/reports

  - run:
      command: |
        ./node_modules/ava/cli.js --tap | ./node_modules/tap-xunit/bin/tap-xunit > ~/reports/ava.xml
      when: always

  - store_test_results:
      path: ~/reports

  - store_artifacts:
      path: ~/reports

  - save_cache:
        - node_modules
      key: v1-dependencies-{{ checksum "package.json" }}

The error’s url discusses this, but I’m not sure exactly how to modify my config file to do what they suggest

Scroll down to #running-puppeteer-in-docker

The question is fine here, but you might get more exposure on Stack Overflow or similar. I’d say the most important error is “Failed to launch chrome”, so I’d do some searching around that.

One other thing to consider is if you are finding local/Circle discrepancies awkward, you could get your tests to run in a Docker image locally, and then run that in CircleCI. I do that with a number of repos, and it means I can do a quick set of tests in a Circle-like environment even on my local machine (or, rather, both my laptop and Circle are like the container image in each case).


  • Change docker image to: image: circleci/node:latest-browsers
  • Add flags to puppeteer.launch
    ‘–no-sandbox’ ‘–disable-setuid-sandbox’

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.