Skip to content

Instantly share code, notes, and snippets.

@winuxue
Created May 22, 2019 01:15
Show Gist options
  • Star 76 You must be signed in to star a gist
  • Fork 15 You must be signed in to fork a gist
  • Save winuxue/cfef08e2f5fe9dfc16a1d67a4ad38a01 to your computer and use it in GitHub Desktop.
Save winuxue/cfef08e2f5fe9dfc16a1d67a4ad38a01 to your computer and use it in GitHub Desktop.
Solution for common dependences issues using puppeteer in ubuntu 18.04 (Bionic)

puppeteer dependeces in ubuntu 18.04 (Bionic)

error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

sudo apt-get install libnss3

error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

sudo apt-get install libxss1

error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory

apt-get install libasound2

error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory

apt-get install libatk-bridge2.0-0

error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory

apt install libgtk-3-0
@activeliang
Copy link

thx~

@Wujek280
Copy link

Wujek280 commented Jul 28, 2021

Had similar problem with Debian 10

sudo apt-get install -yq --no-install-recommends 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 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3

Can't tell if it's overkill but it worked :)

@pabloconti
Copy link

I am working on electron and when I want to run my app in terminal like this:

npm run dev

The output is:

> electronapp@1.0.0 dev

electron index.js

/home/pablitokonti/platzi/electron/cursoElectron/node_modules/electron/dist/electron: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory

I've tried lots of commands but it is still don't working

@jonasjancarik
Copy link

I am working on electron and when I want to run my app in terminal like this:

npm run dev

The output is:

> electronapp@1.0.0 dev

electron index.js

/home/pablitokonti/platzi/electron/cursoElectron/node_modules/electron/dist/electron: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory

I've tried lots of commands but it is still don't working

libgbm.so.1 can be installed with sudo apt install libgbm-dev (source: https://stackoverflow.com/a/67407105/1334688)

@awps
Copy link

awps commented Dec 10, 2021

Here's what worked in my case:

apt-get install libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgbm-dev

@LZL0
Copy link

LZL0 commented Jan 21, 2022

Thank you @awps !

@sebastiaanluca
Copy link

What worked on a new Ubuntu 20.04 VPS:

sudo 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 libatk-bridge2.0-0 libgbm-dev

Had to combine several suggestions to make it work.

@Barna001
Copy link

Thank you @awps , the last comman libgbm-dev was missing from the top answer :)

@varun-nambiar
Copy link

Ubuntu 20.04

apt install -y libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 libxi-dev libxtst-dev libnss3 libcups2 libxss1 libxrandr2 libasound2 libatk1.0-0 libatk-bridge2.0-0 libpangocairo-1.0-0 libgtk-3-0 libgbm1

@amatiash
Copy link

amatiash commented May 6, 2022

For Ubuntu 20.04-amd64-server:

sudo apt-get install libatk1.0-0 libatk-bridge2.0-0 libcups2 libxkbcommon-x11-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libcairo2

If you don't want to install a mess of packages – install one-by-one only the missing ones. That's what I did.

@LuisEstebanArango
Copy link

Thank you @awps !

@JKelly423
Copy link

Here's what worked in my case:

apt-get install libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgbm-dev

Thank you! @awps

@shstkvch
Copy link

What worked on a new Ubuntu 20.04 VPS:

sudo 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 libatk-bridge2.0-0 libgbm-dev

Had to combine several suggestions to make it work.

Thanks Seb, this worked!

@MaksimDrozd
Copy link

thanks

@aman-g202
Copy link

aman-g202 commented Dec 13, 2022

Thanks @sebastiaanluca

Run the apt-get mentioned by @sebastiaanluca

sudo 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 libatk-bridge2.0-0 libgbm-dev

Followed by lunch the chrome process with no-sandbox argument

this.browser = await puppeteer.launch({
   headless: true,
   args: ["--no-sandbox"],
});

@manokaran68
Copy link

manokaran68 commented Dec 13, 2022

Thank you Sebastian Luca

@vostersc
Copy link

Thank you.

@davidric
Copy link

davidric commented Jan 26, 2023

libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgbm-dev

It works. Thanks @awps!

@joecorsi
Copy link

joecorsi commented May 24, 2023

anyone running ubuntu 22.04 LTS, i just went though each dependecy for puppeteer as they came up:

  • libatk-bridge2.0-0
  • libcups2
  • libxkbcommon.so.0
  • libXcomposite.so.1
  • libXdamage.so.1
  • libXfixes.so.3
  • libXrandr.so.2
  • libgbm.so.1
  • libpango-1.0.so.0

after installing everything above and using args: ["--no-sandbox"], puppeteer works.

@delvinjoseph
Copy link

What worked on a new Ubuntu 20.04 VPS:

sudo 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 libatk-bridge2.0-0 libgbm-dev

Had to combine several suggestions to make it work.

Worked for me

@MarioVillar
Copy link

Here's what worked in my case:

apt-get install libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgbm-dev

That worked for me too! Thank you for the solution!

@Solaimanx
Copy link

sudo apt-get install -yq --no-install-recommends 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 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3

This worked for me

@jaimeivan
Copy link

thank you !!!

@iJustErikk
Copy link

legends

@miaopanpan
Copy link

apt-get install libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgbm-dev

thank you

@VGerris
Copy link

VGerris commented Mar 27, 2024

anyone running ubuntu 22.04 LTS, i just went though each dependecy for puppeteer as they came up:

* libatk-bridge2.0-0

* libcups2

* libxkbcommon.so.0

* libXcomposite.so.1

* libXdamage.so.1

* libXfixes.so.3

* libXrandr.so.2

* libgbm.so.1

* libpango-1.0.so.0

after installing everything above and using args: ["--no-sandbox"], puppeteer works.

This is my list, not using options but the grafana module for icinga :
- libatk-bridge2.0-0
- libcups2
- libxcomposite1
- libxdamage1
- libxfixes3
- libxrandr2
- libgbm1
- libxkbcommon-x11-0
- libpango1.0-0
- libasound2

Thank you

@samal-rasmussen
Copy link

Ubuntu 22.04 command:
sudo apt install -y libatk1.0-0 libatk-bridge2.0-0 libcups2 libxcomposite-dev libxdamage1 libxrandr2 libgbm1 libxkbcommon-x11-0 libpango1.0-0 libasound2

Thank you @VGerris @joecorsi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment