A strange issue I am facing while developing an electron app. What I am trying to achieve is use lighthouse
to conduct page audits. I am using it programmatically like this
const command = `lighthouse ${website} --quiet --chrome-flags=--headless --output-path=${outputPath} --output html --emulated-form-factor=${strategy} --only-categories=${options}`;
os.execCommand(command, function() {
res.send(response);
});
What it does is executes a lighthouse
as a command in Main thread(nodejs). I have mentioned lighthouse
as a dependency in package.json
and it works perfectly in development
mode.
The strange part is, when the package is created it gives me an error lighthouse is not a recognized command
How can I resolve this dependency ? or provide the command path from node_modules
>
Kindly guide.
PS: Unable to use lighthouse as a module using require
. Also This is a standalone application hosting this service internally.