user12586173
user12586173

Reputation:

Puppeteer fails to connect to Chromium on Windows 10

Tell us about your environment:

Puppeteer version: 1.11.0 Platform / OS version: Windows 10 1709 URLs (if applicable): Node.js version: 10.x.x as well as 11.4.0 What steps will reproduce the problem?

const puppeteer = require("puppeteer"); puppeteer.launch(); What is the expected result? A headless browser launching in the background and no console error.

What happens instead? chrome.exe is run without any command line switch, opening a non-headless window and eventually the tab also crashes, until it is killed by Puppeteer.

(node:27296) UnhandledPromiseRejectionWarning: TimeoutError: Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r609904
    at Timeout.onTimeout (C:\Projects\foo\node_modules\puppeteer\lib\Launcher.js:353:14)
    at listOnTimeout (timers.js:324:15)
    at processTimers (timers.js:268:5)
(node:27296) 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:27296) [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 added console.log(chromeArguments) in Launcher.js just before it spawns the Chromium process -

[ '--disable-background-networking',
  '--disable-background-timer-throttling',
  '--disable-backgrounding-occluded-windows',
  '--disable-breakpad',
  '--disable-client-side-phishing-detection',
  '--disable-default-apps',
  '--disable-dev-shm-usage',
  '--disable-extensions',
  '--disable-features=site-per-process',
  '--disable-hang-monitor',
  '--disable-ipc-flooding-protection',
  '--disable-popup-blocking',
  '--disable-prompt-on-repost',
  '--disable-renderer-backgrounding',
  '--disable-sync',
  '--disable-translate',
  '--metrics-recording-only',
  '--no-first-run',
  '--safebrowsing-disable-auto-update',
  '--enable-automation',
  '--password-store=basic',
  '--use-mock-keychain',
  '--headless',
  '--hide-scrollbars',
  '--mute-audio',
  '--disable-gpu',
  'about:blank',
  '--remote-debugging-port=0',
  '--user-data-

dir=C:\Users\foobaz\AppData\Local\Temp\puppeteer_dev_profile-tW27Rg' ] Something makes Node.js ignore the arguments. There is no existing chrome.exe (of Chromium) active, only chrome.exe of Chrome.

Upvotes: 0

Views: 2638

Answers (2)

Parvat R
Parvat R

Reputation: 846

I too had the same problem, then I installed puppeteer-core using

npm i puppeteer-core

and, that solved my problem.

Upvotes: 1

i-Guru
i-Guru

Reputation: 184

I found this on github issues.

--disable-extensions is forbidden in my corporate environment.

That was stupid (the extensions it mandates are not security sensitive or protective or enforcing anything).

puppeteer.launch({ignoreDefaultArgs: ['--disable-extensions']}) fixes it

Upvotes: 0

Related Questions