dzava / lighthouse-php

A PHP interface for Google Lighthouse
MIT License
40 stars 17 forks source link

Audit of 'http://example.com' failed #3

Closed TheYaXxE closed 3 years ago

TheYaXxE commented 5 years ago

Hi.

I'm having issues getting this to work in my Laravel Application. I've done everything as requested:

  1. Added the following to my composer.json.
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/dzava/lighthouse-php"
        }
    ],
    "require": {
        "dzava/lighthouse": "dev-master",
    },
  2. Installed the library using composer require dzava/lighthouse
  3. Installed Google Lighthouse using yarn add lighthouse

But when I try to run it, I get an "Audit of 'DOMAIN-NAME' failed", no matter the URL. I've also tried to use the setLighthousePath, but still the same.

    public function LightHouseScan($url) {
        return (new Lighthouse())
            ->setLighthousePath('../../node_modules/lighthouse/lighthouse-cli/index.js')
            ->setOutput('report.json')
            ->accessibility()
            ->bestPractices()
            ->performance()
            ->pwa()
            ->seo()
            ->audit($url);
    }

Any idea why this is happening?

dzava commented 5 years ago

Try this to see why it fails

public function LightHouseScan($url) {
    try {
        return (new Lighthouse())
        ->setLighthousePath('../../node_modules/lighthouse/lighthouse-cli/index.js')
        ->setOutput('report.json')
        ->accessibility()
        ->bestPractices()
        ->performance()
        ->pwa()
        ->seo()
        ->audit($url);
    } catch(AuditFailedException $e) {
        dd($e->getOutput());
    }
}
TheYaXxE commented 5 years ago

That outputs the exact same error message: Audit of 'http://example.com' failed

AmityTek commented 3 years ago

Got the same error ... anyone can help us ?

Thanks

dzava commented 3 years ago

Check the value of $exception->getOutput() to see why it failed.

AmityTek commented 3 years ago

http://prntscr.com/w76fw4 and I don't how to solve this

dzava commented 3 years ago

Use the setChromePath($path) method to specify the location of the chrome binary.

AmityTek commented 3 years ago

Even if I specify the location itsn't working ... always the same error