chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory

Author: shijiezhou1Created Feb 10, 2021Updated Jul 27, 2022

Does any one fix this problem?

I'm deploying my app tho the bitbucket pipelines and it seems not working at all.

-  Building for production...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
Error: Failed to launch chrome!
/app/node_modules/puppeteer/.local-chromium/linux-686378/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 (/app/node_modules/puppeteer/lib/Launcher.js:348:14)
    at Interface.<anonymous> (/app/node_modules/puppeteer/lib/Launcher.js:337:50)
    at Interface.emit (events.js:327:22)
    at Interface.close (readline.js:416:8)
    at Socket.onend (readline.js:194:10)
    at Socket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1220:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
[Prerenderer - PuppeteerRenderer] Unable to start Puppeteer
(node:19) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'close' of null
    at PuppeteerRenderer.destroy (/app/node_modules/@prerenderer/renderer-puppeteer/es6/renderer.js:140:21)
    at Prerenderer.destroy (/app/node_modules/@prerenderer/prerenderer/es6/index.js:87:20)
    at /app/node_modules/prerender-spa-plugin/es6/index.js:144:29
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:19) 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:19) [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.

I tried those below and getting another error.

bash
sudo apt-get install ca-certificates fonts-liberation gconf-service libappindicator1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 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 lsb-release wget xdg-utils

The is another problem after I installed it.

Building dependency tree...
Reading state information...
Package fonts-liberation is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package xdg-utils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Unable to locate package gconf-service
E: Unable to locate package libasound2
E: Unable to locate package libgconf-2-4
E: Unable to locate package libgtk-3-0
E: Unable to locate package libnspr4
E: Unable to locate package libx11-xcb1
E: Unable to locate package libxss1
E: Unable to locate package libxtst6
E: Package 'fonts-liberation' has no installation candidate
E: Unable to locate package libappindicator1
E: Unable to locate package libnss3
E: Unable to locate package lsb-release
E: Package 'xdg-utils' has no installation candidate
The command '/bin/sh -c apt-get install 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' returned a non-zero code: 100

Source: chrisvfritz/prerender-spa-plugin