Installing dependencies to get Puppeteer 1.0 running on Ubuntu 16.04

Installing dependencies to get Puppeteer 1.0 running on Ubuntu 16.04
Rate This Post

When trying to run Puppeteer 1.0 within your Node.JS scripts on an Ubuntu 16.04 box and you keep getting messages (but not limited to) like:

  • error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
  • error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
  • error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory
  • error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

Getting Puppeteer 1.0 running on Ubuntu 16.04 requires a few dependencies installed before you can use it within your Node.JS scripts. These dependencies are specifically listed on the Puppeteer troubleshooting page and also outlined in the error message returned after running the command. We could, in theory, install those dependencies one-by-one, but to get up and running very quickly you can install the libgtk-3.0 package to get many of the dependencies taken care of.

For those who are a bit lazy and want the apt-get code to get up and running use the following:

  1. sudo apt-get install libgtk-3.0 libasound2 libnss3 libxss1

Assumptions

The above worked for me on my Linode default Ubuntu 16.04.2 image and also on my development Vagrant box which uses a bare-bones Ubuntu cloud image .  I’m sure results will vary for others, but the above command took care of all my dependencies to get started.