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

Most upvoted comments

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:

sudo apt-get install -y libxtst6 libnss3 libnspr4 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgdk-pixbuf2.0-0

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 up

Arrived 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

const browser = await puppeteer.launch({
    headless: true,
    args: ['--no-sandbox', '--disable-setuid-sandbox'],
});

and got this result:

(node:21758) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): 
Error: Failed to launch chrome!
/home/pi/fetchbotlokal/node_modules/puppeteer/.local-chromium/linux-526987/chrome-
linux/chrome: 3: /home/pi/fetchbotlokal/node_modules/puppeteer/.local-chromium/linux-
526987/chrome-linux/chrome: Syntax error: ")" unexpected


TROUBLESHOOTING: 
https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:21758) [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 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:

const browser = await puppeteer.launch({
          headless: true,
          executablePath: '/usr/bin/chromium-browser',
          args: ['--no-sandbox', '--disable-setuid-sandbox']
  });

Many thanks to:

chsamii.medium.com

I also get the same issue But it solves in my case.

const browser = await puppeteer.launch({
    headless: true,
   executablePath:'/home/sagar/workplace/scraping-demo/node_modules/puppeteer/.local-chromium/linux-599821/chrome-linux/chrome',
    args: ['--no-sandbox', '--disable-setuid-sandbox'],
  });

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:

  1. sudo apt install libxkbcommon-x11-0
  2. sudo apt-get install -y libgbm-dev

UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! /home/container/node_modules/puppeteer/.local-chromium/linux-800071/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md at onClose (/home/container/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20) at Interface. (/home/container/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68) 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) (node:24) 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:24) [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 am getting this error, Please help guys

I got same error. For me fix was in this comment: https://github.com/puppeteer/puppeteer/issues/3443#issuecomment-433096772

You will require the following Dependencies

sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.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

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 up

Solved my issue too. Thanks!

I have run command sudo apt-get install chromium-browser Setting up link is missing

Now I get: Failed to launch the browser process!\n[0630/113319.336643:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md\n

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:

image: node:14
pipelines:
  default:
    - step:
        name: INSTALL AND BUILD
        caches:
          - node
        script:
          - apt-get update
          - 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
          - npm run install
          - npm run build

Just put this part below for your pipeline and it turns out to works.

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

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:

const puppeteer = require("puppeteer");

(async () => {
	const browser = await puppeteer.launch();
	const page = await browser.newPage();
	await page.goto("https://www.armani.com");
	await page.screenshot({ path: "armani.png" });

	await browser.close();
})();

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:

ERROR: The process "4836" not found.
(node:5012) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
[4836:14316:0424/162745.667:ERROR:install_util.cc(589)] Unable to create registry key HKLM\SOFTWARE\Policies\Chromium for reading result=2
[9824:2488:0424/162750.207:ERROR:gles2_cmd_decoder_passthrough_doers.cc(4126)] NOT IMPLEMENTED


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (C:\Code\puppeteerMeasurePerf\node_modules\puppeteer\lib\Launcher.js:255:14)
    at ChildProcess.helper.addEventListener (C:\Code\puppeteerMeasurePerf\node_modules\puppeteer\lib\Launcher.js:245:60)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
(node:5012) 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(). (rejection id: 1)
(node:5012) [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.

So I tried with the real Chrome on my machine, changing the launch() artuments with the following:

	const browser = await puppeteer.launch({
		headless: true,
		executablePath:
			"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
	});

And Chrome launches, but it does nothing. It’s just there in the “new tab” page, waiting. When I close it, I get:

ERROR: The process "15136" not found.
(node:7988) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:13572:0424/162924.897:ERROR:in_progress_cache_impl.cc(189)] Cache is not initialized, cannot RetrieveEntry.
[15136:752:0424/162924.913:ERROR:in_progress_cache_impl.cc(93)] Could not read download entries from file because there was a read failure.


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (C:\Code\puppeteerMeasurePerf\node_modules\puppeteer\lib\Launcher.js:255:14)
    at ChildProcess.helper.addEventListener (C:\Code\puppeteerMeasurePerf\node_modules\puppeteer\lib\Launcher.js:245:60)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
(node:7988) 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(). (rejection id: 1)
(node:7988) [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.

Can somebody help me out understanding what’s happening?

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

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?