puppeteer: Failed to launch chrome
Steps to reproduce
Tell us about your environment:
- Puppeteer version: 0.10.1
- Platform / OS version: Ubutntu 16.04 running on AWS EC2
- URLs (if applicable):
What steps will reproduce the problem? Try the demo code to launch puppeteer in ubuntu 16.04 EC2 amazon AWS.
Code used:
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
What is the expected result?
It is able to start in my local. When I deployed in my EC2 I am getting this error. Couldn’t find a past issue related to this.
What happens instead? It throws error
(node:15966) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: Error occured Error: Failed to launch chrome!
/home/ubuntu/ranker-backend/node_modules/puppeteer/.local-chromium/linux-496140/chrome-linux/chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 104
- Comments: 42 (6 by maintainers)
Commits related to this issue
- Added a pa11y config to stop the google chrome issues. See https://github.com/GoogleChrome/puppeteer/issues/807 — committed to linaro-marketing/jekyll-pa11y by deleted user 5 years ago
- Chore: Install Ubuntu libraries for Puppeteer See https://github.com/puppeteer/puppeteer/issues/807#issuecomment-709891984 — committed to michaeluno/web-page-dumper by michaeluno 3 years ago
It looks like you are missing some Debian dependencies: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
Im using puppeteer nugetpackage 1.9.0. I also had the same issue that browser couldn’t launch in my linux container. I added this line in my dockerfile and it fixed the problem for me:
apt-get install -y wget unzip fontconfig locales 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
reference: https://hub.docker.com/r/browserless/chrome/
Thank @DdannyB. To get an up to date list of your missed dependencies, see: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
In my case, these ones were missed:
Puppeteer: v1.17.0 CI: CircleCI v2
(This additional step is not required if you use Travis, as I saw.)
const browser = await puppeteer.launch({ headless: true, args: [‘–no-sandbox’, ‘–disable-setuid-sandbox’], }); works for me in aws elastic beanstalk environment . I installed the dependencies by refering the https://medium.com/mockingbot/run-puppeteer-chrome-headless-on-ec2-amazon-linux-ami-6c9c6a17bee6
if you get Failed to launch the browser process it possible that you didn’t install chromium
sudo apt-get install chromium-browser
and then setting upArrived here in that (now closed) after I made troubleshooting why puppeteer won’t start. I’ve already read the troubleshooting document (relating debian/ubuntu) and now cant get pupeteer running on my rpi3.
I’ve tried to execute the puppeteer launch script from above
and got this result:
I am trying to run puppeteer from heroku in nodeJS.
I get the below error:
Error: Failed to launch chrome!\n/app/node_modules/puppeteer/.local-chromium/linux-624492/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n…
Raspberry Pi’ are ARM based, which as explained above is not supported as arm builds of Chromium are not provided for development testing purposes by the Chromium Team.
Launch puppeteer+chromium-headless on RPI: Yes we can ! (tested on RPI4): Simply do:
sudo apt install chromium-browser chromium-codecs-ffmpeg
and then add:
Many thanks to:
chsamii.medium.com
I also get the same issue But it solves in my case.
When you are using headless: true options then also use the option executablePath give the accurate path of your chrome file in node_modules folder, like above. In my case i am putting whole path of my system, where my chrome file.
ELF not found
looks like that is an ARM build. Which puppeteer currently does not support (ref issue #550).works perfectly in centos 7
To install chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo yum localinstall google-chrome-stable_current_x86_64.rpm
This worked for me:
I got same error. For me fix was in this comment: https://github.com/puppeteer/puppeteer/issues/3443#issuecomment-433096772
did you able to solve the issue?
For those who reach here for Heroku install of puppeteer, please ensure you add the build pack: https://elements.heroku.com/buildpacks/jontewks/puppeteer-heroku-buildpack to resolve this issue.
I got the same problem on bitbucket and this fixed my problem.
Bitbucket:
Just put this part below for your pipeline and it turns out to works.
this solution work for me https://techoverflow.net/2018/06/05/how-to-fix-puppetteer-error-while-loading-shared-libraries-libx11-xcb-so-1-cannot-open-shared-object-file-no-such-file-or-directory/
Hi there, I’m on Windows 10 (work machine…) and I just installed
puppeteer
on a new, empty npm project.npm install puppeteer
Then created this simple script:
And Chromium launches, but it does nothing. It’s just there in the “new tab” page, waiting. When I close it, I get this nasty error:
So I tried with the real Chrome on my machine, changing the
launch()
artuments with the following:And Chrome launches, but it does nothing. It’s just there in the “new tab” page, waiting. When I close it, I get:
Can somebody help me out understanding what’s happening?
Check the required dependencies. As mentioned previously. This is your installation missing a required 3rd party library package, not a problem with Puppeteer.
I got the following error when I tried to run it on my amazon linux
bash-4.2$ vi chrome bash-4.2$ ./chrome -v ./chrome: error while loading shared libraries: libXcursor.so.1: cannot open shared object file: No such file or directory bash-4.2$ pwd /usr/share/nginx/magentopuppeteer/node_modules/puppeteer/.local-chromium/linux-515411/chrome-linux bash-4.2$ cat /etc/*-release NAME=“Amazon Linux AMI” VERSION=“2017.09” ID=“amzn” ID_LIKE=“rhel fedora” VERSION_ID=“2017.09” PRETTY_NAME=“Amazon Linux AMI 2017.09” ANSI_COLOR=“0;33” CPE_NAME=“cpe:/o:amazon:linux:2017.09:ga” HOME_URL=“http://aws.amazon.com/amazon-linux-ami/” Amazon Linux AMI release 2017.09 bash-4.2$
@claudiuIO can you please share your exact error message? And the OS version? If you do indeed have the same error, then you missed installing a dependency most likely.
I am having the same issue. All the debian dependencies are installed. Any advice to make chromium run?