So i had this working at one point but it is now failing in my laravel app. So i have my call to the lighthouse audit in my app/Models/Account.php file
(new Lighthouse())
->setOutput( $link )
->setTimeout( 180 )
->accessibility()
->bestPractices()
->performance()
->pwa()
->seo()
->setLighthousePath('./../../node_modules/lighthouse/lighthouse-cli/index.js')
->audit($this->url);
$html = '
<a href="/report.html" target="_blank">Click here to show the lighthouse report in a new tab</a>';
} catch( AuditFailedException $e ) {
logger( $e );
$html = '
<p>' . $e->getOutput() . '</p>';
}
I get an error in my log exec: ./node_modules/lighthouse/lighthouse-cli/index.js: not found however i find I have no lighthouse-cli folder but do have a cli folder in lighthouse and in there is an index.js file. I have also tried ./../node_modules/lighthouse/lighthouse-cli/index.js, ./../../node_modules/lighthouse/lighthouse-cli/index.js, exec: ./../../node_modules/lighthouse/cli/index.js: not found and probably other varients but the report doesnt audit.
I have installed dzava/lighthouse with composer and yarn installed lighthouse (as per the docs - https://github.com/dzava/lighthouse-php) and confirm that the index.js file is in node_modules/lighthouse/cli/ what is causing this issue? what should be the correct path? why is it assuming the path is ./node_modules/lighthouse/lighthouse-cli/index.js despite there being no lighthouse-cli folder? Has anyone got this to work in laravel with dzava/lighthouse version 0.2.0?