Skip to content

Chromelauncher error on when killing instance #2337

@li-kai

Description

@li-kai

I've been trying to get headless chrome running, but I've been getting Error: read ECONNRESET which I've been able to reproduce consistently here:

const lighthouse = require('lighthouse');
const chromeLauncher = require('lighthouse/chrome-launcher/chrome-launcher');

async function runLighthouse(url) {
  const opts = {
    chromeFlags: ['--headless'],
  };
  const chrome = await chromeLauncher.launch(opts);
  const flags = {
    output: 'json',
    port: chrome.port,
  };
  const results = await lighthouse(url, flags);
  await chrome.kill();
  return results;
}

runLighthouse('https://example.com');

Node versions used: 6.8.0 & 7.9.0
Lighthouse: 2.0.0
OS: Mac OS Sierra 10.12.4 & Ubuntu LTS 14.04 (Travis)

I've been able to fix this by either catching the process.on('uncaughtException', ... event in chrome-launcher.js, or setting a timeout on the await chrome.kill(); code. Neither of which I believe is ideal since I'm quite new to Node.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions