puppeteer: Puppeteer install hangs indefinitely

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!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 18

Most upvoted comments

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.

Same issue here. Using VPN works. so change your network if you are facing this issue.

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.

After 3 days trying to run npm install, using different node and npm versions, deleting node_modules, package-lock, and doing all the possible variations, the process just stuck at different %, I changed my connection (normal ethernet connection) to a 4G mobile connected using USB and it just worked without any problem.