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 install hangs indefinitely

See original GitHub issue

I’m experiencing one weird issue with npm install puppeteer - the installation idenfinitely hangs on Downloading Chromium r662092 - 111.6 Mb [====================] 99% 0.0s.

The same has been already reported in https://github.com/puppeteer/puppeteer/issues/4688 , but closed as automagically solved.

I couldn’t believe there is any magic involved so I decided to troubleshoot it and found a solution to install the module on my environment without the installation hanging. Despite having solution, I can reliably replicate the issue. In short:

  • the issue only occurs when I’m connected to a 802.11n 2.4GHz wifi SSID
  • being connected to a 5GHz 802.11ac SSID configured on the same wifi access point, the npm install puppeteer works as expected.

Even it looks like the culprit might be in the misconfigured AP or some weird network connection/configuration, I think, the real culprit lies somewhere in the install scripts: install.js / BrowserFetcher.js, where downloading the last chunk of the chromium browser somehow never finish.

Steps to reproduce

I’m worried you won’t be able to replicate the issue, but I will provide as much as possible data so that it might be possible to find the bug inside the code despite not being able to replicate it on your own machine.

Tell us about your environment:

What steps will reproduce the problem?

  1. Connect to my local 802.11n 2.4GHZ SSID. ( AP running OpenWRT v19.07.2)
  2. Install puppeteer: npm install puppeteer@1.17.0
  3. Installation hangs indefinitely with following output:
$ npm install puppeteer@1.17.0

> puppeteer@1.17.0 install /home/p/workspace/p/node_modules/puppeteer
> node install.js

Downloading Chromium r662092 - 111.6 Mb [====================] 99% 0.0s

The same is for other versions:

$ npm install puppeteer@1.18.1

> puppeteer@1.18.1 install /home/p/workspace/p/node_modules/puppeteer
> node install.js

Downloading Chromium r672088 - 112.1 Mb [====================] 99% 0.0s
  1. Connect to a 5GHz 802.11ac SSID or 2.4GHz 802.11ac SSID and everything works:
$ npm install puppeteer@1.17.0

> puppeteer@1.17.0 install /home/p/workspace/p/node_modules/puppeteer
> node install.js

Downloading Chromium r662092 - 111.6 Mb [====================] 100% 0.0s 
Chromium downloaded to /home/p/workspace/p/node_modules/puppeteer/.local-chromium/linux-662092
+ puppeteer@1.17.0
updated 1 package and audited 51 packages in 9.066s
found 0 vulnerabilities

What is the expected result?

$ npm install puppeteer@1.17.0

> puppeteer@1.17.0 install /home/p/workspace/p/node_modules/puppeteer
> node install.js

Downloading Chromium r662092 - 111.6 Mb [====================] 100% 0.0s 
Chromium downloaded to /home/p/workspace/p/node_modules/puppeteer/.local-chromium/linux-662092
+ puppeteer@1.17.0
updated 1 package and audited 51 packages in 9.066s
found 0 vulnerabilities

What happens instead?

$ npm install puppeteer@1.17.0

> puppeteer@1.17.0 install /home/p/workspace/p/node_modules/puppeteer
> node install.js

Downloading Chromium r662092 - 111.6 Mb [====================] 99% 0.0s

And here it hangs indifinetly

Other details I tried to debug the installation and used following code modifications to print content of downloadedByte, chunk size, etc when running the install on the broken SSID:

install.js:

104,105d103
<   console.log(`delta: ${delta}`);
<   console.log(`lastDownloadedBytes: ${lastDownloadedBytes}`);

lib/BrowserFetcher.js:

249a250
>     console.log(`chunk.length: ${chunk.length}`);
250a252
>     console.log(`downloadedBytes: ${downloadedBytes}`);

Then running node install.js resulted in following output:

content-length: 116993080
totalBytes: 116993080
chunk.length: 279
downloadedBytes: 279
Downloading Chromium r662092 - 111.6 Mb [                    ] 0% 0.0s chunk.length: 1378
downloadedBytes: 1657
chunk.length: 1378
downloadedBytes: 3035
chunk.length: 1378
...
// lots of data
...
lastDownloadedBytes: 116914804
chunk.length: 16384
downloadedBytes: 116931188
delta: 16384
lastDownloadedBytes: 116931188
chunk.length: 16384
downloadedBytes: 116947572
delta: 16384
lastDownloadedBytes: 116947572
Downloading Chromium r662092 - 111.6 Mb [====================] 99% 0.0s chunk.length: 16384
downloadedBytes: 116963956
delta: 16384
lastDownloadedBytes: 116963956
chunk.length: 16384
downloadedBytes: 116980340
delta: 16384
lastDownloadedBytes: 11698034

And here it hangs indifinetely. It looks it never finishes the download, never ticks onSuccess here…

Connecting to the correct SSID, running the node install.js again looks like this:

content-length: 116993080
totalBytes: 116993080
chunk.length: 267
downloadedBytes: 267
delta: 267
lastDownloadedBytes: 267
Downloading Chromium r662092 - 111.6 Mb [                    ] 0% 0.0s chunk.length: 1366
downloadedBytes: 1633
delta: 1366
lastDownloadedBytes: 1633
chunk.length: 1366
downloadedBytes: 2999
delta: 1366
lastDownloadedBytes: 2999
chunk.length: 1366
downloadedBytes: 4365
delta: 1366
lastDownloadedBytes: 4365
chunk.length: 1366
downloadedBytes: 5731
delta: 1366
...
// lots of data
...
lastDownloadedBytes: 116965376
chunk.length: 16384
downloadedBytes: 116981760
delta: 16384
lastDownloadedBytes: 116981760
chunk.length: 11320
downloadedBytes: 116993080
delta: 11320
lastDownloadedBytes: 116993080
Downloading Chromium r662092 - 111.6 Mb [====================] 100% 0.0s 
Chromium downloaded to /home/p/workspace/p/node_modules/puppeteer/.local-chromium/linux-662092

Let me know if i can provide you any other information or test any fix, I’ll be glad to test it on the broken SSID.

Thanks in advance for any help!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:18

github_iconTop GitHub Comments

4reactions
stale[bot]commented, Jun 23, 2022

We’re marking this issue as unconfirmed because it has not had recent activity and we weren’t able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

3reactions
ranmancommented, May 18, 2021

I can confirm this also happens for me on certain wifi networks. No idea why. Just switched to my phone hotspot and it installed correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer Tutorial | Fixing Common Errors while installing ...
Solution: Install all the missing dependencies. Once that's done, puppeteer is ready to be run, without those pesky errors! Case 2: Running ...
Read more >
npm install hangs - node.js - Stack Overflow
Re-trying npm install waits forever on the same package again and again. After waiting for a long timeout, npm install printed an error...
Read more >
How to simply workaround RAM-leaking libraries like ...
Universal way to fix RAM leaks once and forever. Default Editor ... First of all start a new NPM project and install puppeteer:...
Read more >
Troubleshooting - Jest
Troubleshooting. Uh oh, something went wrong? Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why​.
Read more >
How to handle a socket hang up error in Node.js usually - Quora
Socket hang up error is thrown in two cases. ... You should always have these event handlers installed in development code as they'll...
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