Lighthouse playwrite :: TypeError: Failed to fetch browser webSocket URL from http://127.0.0.1:9222/json/version: fetch failed

106 Views Asked by At

I am using lighthouse first time and dont know how I can proceed with below error:

TypeError: Failed to fetch browser webSocket URL from http://127.0.0.1:9222/json/version: fetch failed

const lighthouseOptions = {
      logLevel: 'info',
      output: 'html',
      onlyCategories: ['performance'],
      port: 9222,
    };

    const lighthouse = require('lighthouse/core/index.cjs');

    const runnerResult = await lighthouse("https://www.google.com/", lighthouseOptions as any);

    // `.report` is the HTML report as a string
    const reportHtml = runnerResult!.report;
    fs.writeFileSync('./lighthouse-report.html', reportHtml);
  

Any assistance is highly appreciated.

0

There are 0 best solutions below