Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: connect ECONNREFUSED 127.0.0.1:9222 #226

Open
Toolo opened this issue Feb 3, 2020 · 0 comments
Open

Error: connect ECONNREFUSED 127.0.0.1:9222 #226

Toolo opened this issue Feb 3, 2020 · 0 comments

Comments

@Toolo
Copy link

Toolo commented Feb 3, 2020

Config / CLI options

pwmetrics https://example.com is not working on a fresh yarn global install.

Steps to reproduce.

yarn global add pwmetrics
pwmetrics https://example.com

Debugging info

  1. Using lighthouse
yarn global add lighthouse
lighthouse https://example.com

This command works fine and Chrome is launched.

  1. Using chrome-launcher
const ChromeLauncher = require('chrome-launcher');

ChromeLauncher.launch({
  port: 9222,
  startingUrl: 'http://localhost:9000/us/en-us/suv-rental',
}).then(chrome => {
  console.log(`Chrome debugging port running on ${chrome.port}`);
});

Chrome is launched.

  1. Calling lighthouse programmatically works
const ChromeLauncher = require('chrome-launcher');
const lighthouse = require('lighthouse');

ChromeLauncher.launch({
  startingUrl: 'https://example.com',
}).then(chrome => {
  console.log(`Chrome debugging port running on ${chrome.port}`);
  return lighthouse('https://example.com', {port: chrome.port}).then(results => {
    return chrome.kill().then(() => console.log(results.lhr));
  });
});

This prints the audit output to console.

  1. Manual programmatic override
const ChromeLauncher = require('chrome-launcher');
const PWMetrics = require('pwmetrics');

ChromeLauncher.launch({
  startingUrl: 'https://example.com',
}).then(chrome => {
  console.log(`Chrome debugging port running on ${chrome.port}`);
  const options = {
    flags: {
      chromeFlags: '--headless',
      port: chrome.port,
      runs: 1,
    },
  };
  const pwMetrics = new PWMetrics('http://example.com/', options);
  return pwMetrics.start();
});

image

Stack trace

Launching Chrome
{ Error
    at new LauncherError (/Users/esuaram/.config/yarn/global/node_modules/pwmetrics/node_modules/chrome-launcher/dist/utils.js:35:22)
    at new ChromeNotInstalledError (/Users/esuaram/.config/yarn/global/node_modules/pwmetrics/node_modules/chrome-launcher/dist/utils.js:66:9)
    at Launcher.<anonymous> (/Users/esuaram/.config/yarn/global/node_modules/pwmetrics/node_modules/chrome-launcher/dist/chrome-launcher.js:145:27)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/esuaram/.config/yarn/global/node_modules/pwmetrics/node_modules/chrome-launcher/dist/chrome-launcher.js:9:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
  message: 'No Chrome installations found.',
  code: 'ERR_LAUNCHER_NOT_INSTALLED' }
  ✘ Error: Unable to complete run 1 of 1 due to connect ECONNREFUSED 127.0.0.1:9222.

Environment

  1. pwmetrics version: 4.2.3
  2. Chrome version: 79.0.3945.130
  3. OS version: macOS Catalina 10.15.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant