question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Puppeteer just hangs with default Chrome installation

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.11.0
  • Platform / OS version: Linux Ubuntu 14.04 x86_64
  • URLs (if applicable):
  • Node.js version: 10.14.1

What steps will reproduce the problem?

const puppeteer = require('puppeteer');
(async() => {
   const browser = await puppeteer.launch();
   const page = await browser.newPage();
   await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36');
   await page.setViewport({width:960,height:768});
   await page.goto('https://google.com/', {timeout: 40000, waitUntil: 'domcontentloaded'});
   await page.screenshot({ fullPage: true, path: 'screenshot.jpg' });
   await browser.close();
})();
  1. Install puppeteer with npm i puppeteer command .
  2. Run this code sample with node make-screenshot.js command to make a screenshot of webpage.

What is the expected result? Puppeteer should save screenshot as expected.

What happens instead? Puppeteer just hangs, timeout doesn’t work.

How to fix it now? I solved it by installing chromium-browser separately: sudo apt update sudo apt install -y chromium-browser chromium-browser --version

And then we have to change executable path in the code example to make it work:

const puppeteer = require('puppeteer');
(async() => {
   const browser = await puppeteer.launch({executablePath: 'chromium-browser'}); // <- set path for chromium browser
   const page = await browser.newPage();
   await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36');
   await page.setViewport({width:960,height:768});
   await page.goto('https://google.com/', {timeout: 40000, waitUntil: 'domcontentloaded'});
   await page.screenshot({ fullPage: true, path: 'screenshot.jpg' });
   await browser.close();
})();

Now it works fine for me.

So that puppeteer-core and chromium-browser should be installed insted of just puppeteer.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
antuncommented, Jan 4, 2019

@aslushnikov that doesn’t seem right. Chromium is packaged with Puppeteer, we don’t control the version of Chromium separately. When we do an npm install, Puppeteer automatically chooses the Chromium version it wants via a script. Puppeteer v1.10.0 specifies to use Chromium revision 599821:

https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/package.json#L11

Shouldn’t Puppeteer specify a version of Chromium it’s compatible with?

0reactions
fgroupindonesiacommented, Sep 20, 2020

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.11.0
  • Platform / OS version: Linux Ubuntu 14.04 x86_64
  • URLs (if applicable):
  • Node.js version: 10.14.1

What steps will reproduce the problem?

const puppeteer = require('puppeteer');
(async() => {
   const browser = await puppeteer.launch();
   const page = await browser.newPage();
   await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36');
   await page.setViewport({width:960,height:768});
   await page.goto('https://google.com/', {timeout: 40000, waitUntil: 'domcontentloaded'});
   await page.screenshot({ fullPage: true, path: 'screenshot.jpg' });
   await browser.close();
})();
  1. Install puppeteer with npm i puppeteer command .
  2. Run this code sample with node make-screenshot.js command to make a screenshot of webpage.

What is the expected result? Puppeteer should save screenshot as expected.

What happens instead? Puppeteer just hangs, timeout doesn’t work.

How to fix it now? I solved it by installing chromium-browser separately: sudo apt update sudo apt install -y chromium-browser chromium-browser --version

And then we have to change executable path in the code example to make it work:

const puppeteer = require('puppeteer');
(async() => {
   const browser = await puppeteer.launch({executablePath: 'chromium-browser'}); // <- set path for chromium browser
   const page = await browser.newPage();
   await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36');
   await page.setViewport({width:960,height:768});
   await page.goto('https://google.com/', {timeout: 40000, waitUntil: 'domcontentloaded'});
   await page.screenshot({ fullPage: true, path: 'screenshot.jpg' });
   await browser.close();
})();

Now it works fine for me.

So that puppeteer-core and chromium-browser should be installed insted of just puppeteer.

where the puppet-core usage anyway?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer just hangs with default Chrome installation #3620
Node.js version: 10.14.1. What steps will reproduce the problem? const puppeteer = require('puppeteer'); (async() => ...
Read more >
Puppeteer Hangs In Headless Mode - Stack Overflow
Here's my setup function for my Puppeteer instance: setUpPuppeteer: async () => { const headless = process.env.NODE_ENV === " ...
Read more >
Troubleshooting - Puppeteer
Make sure all the necessary dependencies are installed. You can run ldd chrome | grep not on a Linux machine to check which...
Read more >
Puppeteer Tutorial | Fixing Common Errors while installing ...
This tutorial troubleshoots common errors in Puppeteer. Using the commands and methods provided based on error scenarios, one can fix the ...
Read more >
Chrome tabs intermittent hang or crash with white screen
Problem description: Our users, at seemingly random intervals, experience their tabs going completely white and becoming non responsive. The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found