paulirish / pwmetrics

Progressive web metrics at your fingertipz
Apache License 2.0
1.25k stars 74 forks source link

Error: connect ECONNREFUSED 127.0.0.1:9222 #226

Open Toolo opened 4 years ago

Toolo commented 4 years ago

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.

  2. 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.

3. Calling `lighthouse` programmatically works
```javascript
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](https://user-images.githubusercontent.com/1233927/73659060-6100d900-468d-11ea-824a-966f755f1278.png)

### 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. (/Users/esuaram/.config/yarn/global/node_modules/pwmetrics/node_modules/chrome-launcher/dist/chrome-launcher.js:145:27) at Generator.next () 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