Problem:
You are trying to run puppetteer
on Ubuntu, but when it starts to run chrome, you are facing the following issue:
/home/user/erp/node_modules/puppeteer/.local-chromium/linux-555668/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
Solution
Install the missing packages using
On Ubuntu 24.04:
install_puppetteer_deps_24.04.sh
sudo apt install -y liboss4-salsa-asound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc-s1 libgdk-pixbuf-2.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 libappindicator3-1 libnss3 lsb-release xdg-utils wget
On Ubuntu 22.04:
install_puppetteer_deps_22.04.sh
sudo apt install -y gconf-service libasound2 libatk1.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
On OpenSUSE 15.5:
install_puppetteer_deps_opensuse_15.5.sh
sudo zypper install -y alsa-lib atk glibc cairo cups-libs dbus-1 expat fontconfig libgcc_s1 gdk-pixbuf glib2 gtk3 mozilla-nspr pango libstdc++6 libX11-6 libX11-xcb1 libxcb1 libXcomposite1 libXcursor1 libXdamage1 libXext6 libXfixes3 libXi6 libXrandr2 libXrender1 libXss1 libXtst6 ca-certificates liberation-fonts libappindicator3-1 mozilla-nss lsb-release xdg-utils wget
Credits to @coldner on the puppetteer issue tracker for assembling the required pkgs.
If you encounter E: Unable to locate package
errors, run sudo apt-get update
.
If you want to know more on why this issue occurs, continue reading here.
Puppetteer is essentially a minimal headless (see What is a headless program or application?) Chromium instance with an additional API for controlling and monitoring it from NodeJS.
Even though Puppetteer does not actually display a GUI, the Chromium instance it uses still requires some of the libraries to draw a GUI and connect to the X11 server, even though that isn’t used in Puppetteer. One of those libraries is libxcb
which provides the shared library libX11-xcb.so.1
. You can fix this by installing the libx11-xcb1
package on most Debian-based systems.
However, as it is so often the case with missing shared libraries, once you install the one that is missing, there will be at leastone other library missing after that. That’s why we need to install the large number of libraries listed above.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow