React-snap: Failed to launch chrome! (Ubuntu)

Created on 10 Sep 2018  路  3Comments  路  Source: stereobooster/react-snap

Hi! Thanks for this awesome project.
When I am running react-snap with Ubuntu, I have this error:

Error: Failed to launch chrome!
/home/nachonacho/nacho/react/node_modules/puppeteer/.local-chromium/linux-588429/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory


    TROUBLESHOOTING:         https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/home/nachonacho/nacho/react/node_modules/puppeteer/lib/Launcher.js:333:14)
    at Interface.helper.addEventListener (/home/nachonacho/nacho/react/node_modules/puppeteer/lib/Launcher.js:322:50)
    at Interface.emit (events.js:187:15)
    at Interface.close (readline.js:379:8)
    at Socket.onend (readline.js:157:10)
    at Socket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
error Command failed with exit code 1.

It works perfectly in local, on my computer (mac)

Here you have the versions of the Ubuntu server:
node: v10.6.0
"react-snap": "1.19.0",

Thanks!

Most helpful comment

I know this is closed, but for anyone using arch linux, or possibly another linux distro, I just directly put an executable path for the value of 'puppeteerExecutablePath' in the defaultOptions object, near the top of react-snap/index.js file.

Example:

const defaultOptions = {
  //# stable configurations
  port: 45678,
  source: "build",
  destination: null,
  concurrency: 4,
  include: ["/"],
  userAgent: "ReactSnap",
  // 4 params below will be refactored to one: `puppeteer: {}`
  // https://github.com/stereobooster/react-snap/issues/120
  headless: true,
  puppeteer: {
    cache: true
  },
  puppeteerArgs: [],
  // puppeteerExecutablePath: undefined,
  puppeteerExecutablePath: '/usr/bin/google-chrome-unstable',
...

Hope this is helpful for someone out there!

Edit: Even easier, just pass the following in your package.json, which is somewhat explained loosely in the README:

  "reactSnap": {
    "puppeteerExecutablePath": "/usr/bin/google-chrome-unstable"
  },

Though you probably want to replace 'google-chrome-unstable' with whatever type of chrome you're using. Or direct the path to completely to some other chrome in some other place in your OS.

All 3 comments

The issue here is with Puppeteer. You can check Puppeteer troubleshooting document https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

thanks @stereobooster !
Solved with:

sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

I know this is closed, but for anyone using arch linux, or possibly another linux distro, I just directly put an executable path for the value of 'puppeteerExecutablePath' in the defaultOptions object, near the top of react-snap/index.js file.

Example:

const defaultOptions = {
  //# stable configurations
  port: 45678,
  source: "build",
  destination: null,
  concurrency: 4,
  include: ["/"],
  userAgent: "ReactSnap",
  // 4 params below will be refactored to one: `puppeteer: {}`
  // https://github.com/stereobooster/react-snap/issues/120
  headless: true,
  puppeteer: {
    cache: true
  },
  puppeteerArgs: [],
  // puppeteerExecutablePath: undefined,
  puppeteerExecutablePath: '/usr/bin/google-chrome-unstable',
...

Hope this is helpful for someone out there!

Edit: Even easier, just pass the following in your package.json, which is somewhat explained loosely in the README:

  "reactSnap": {
    "puppeteerExecutablePath": "/usr/bin/google-chrome-unstable"
  },

Though you probably want to replace 'google-chrome-unstable' with whatever type of chrome you're using. Or direct the path to completely to some other chrome in some other place in your OS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShayanJavadi picture ShayanJavadi  路  5Comments

aheissenberger picture aheissenberger  路  7Comments

Marcosul picture Marcosul  路  4Comments

jessevdp picture jessevdp  路  8Comments

rohan-deshpande picture rohan-deshpande  路  5Comments