2

Is it possible to run Puppeteer on Ubuntu Server 16.04? I get this error.

(node:23213) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/root/bin/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory


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

    at onClose (/root/bin/node_modules/puppeteer/lib/Launcher.js:750:14)
    at Interface.<anonymous> (/root/bin/node_modules/puppeteer/lib/Launcher.js:739:50)
    at Interface.emit (events.js:333:22)
    at Interface.close (readline.js:414:8)
    at Socket.onend (readline.js:192:10)
    at Socket.emit (events.js:333:22)
    at endReadableNT (_stream_readable.js:1201:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:23213) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:23213) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

How do I troubleshoot this failure and get the app to run?

2
  • 1
    apt install puppeteer (and all required files for my app). Used npm to run it with node.js. I made a .js script which uses puppeteer, and I want to run it using node myapp.js but it fails at ''puppeteer.launch()''. I tried some guides from the internet about this but didn't worked for me, and I really need it. I might change my ubuntu from 16.04 to 18.04 if no one can help me, but I don't know if that will make the situation any better. – Lmao 123 Feb 13 '20 at 18:57
  • Follow directions from here and it will work for you. Official Troubleshooting Docs – Jeffery ThaGintoki Dec 24 '20 at 10:17
1

I fixed it. I had to update my Linux (sudo-apt get update) then get the libraries. It won't work if you don't update it.

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

After that, I had to add '--no-sandbox', on launch code (from myapp.js).

1

With the most recent version of chromium here is what worked for me. Notice the recently added dependency.

sudo apt-get install libgtk2.0-0 libgtk-3-0 libnotify-dev
sudo apt-get install libgconf-2-4 libnss3 libxss1
sudo apt-get install libasound2 libxtst6 xauth xvfb
#recently added dependency
sudo apt-get install libgbm-dev

If you are using Docker you can add the following to the Docker file. I tested with Docker as well and this works.

RUN apt-get update && \ apt-get install -y libgtk2.0-0 libgtk-3-0 libnotify-dev \ libgconf-2-4 libnss3 libxss1 \ libasound2 libxtst6 xauth xvfb \ libgbm-dev

When making the call to puppeteer added the argument '--no-sandbox'. This is the same as what Lmao suggests. I was not able to get it to work without this option.

For reference I am using Ubuntu 20 but this should work with any distro.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.