unlighthouse
unlighthouse copied to clipboard
Cannot find module puppeteer
Hi @harlan-zw 👋
As you can see in the image unlighthouse never picks puppeteer, even though it is installed globally. I'm using nvm and the path would be /Users/tragio/.nvm/versions/node/v14.19.1/lib/node_modules/
and not file:///Users/tragio, file:///Users/tragio/node_modules
as stated in the error message 🤔 I wonder if the error is related to that.
Thank you for your amazing work 🙏
Same here
Hey @Tragio, @zuramai, sorry you had issues with the package.
I've made a binary that depends on puppeteer to try to get around this issue. Could someone try the below:
Using pnpm
pnpm dlx unlighthouse-puppeteer --site example.com
Using npx
npx unlighthouse-puppeteer --site example.com
@harlan-zw I tried to use but still had the same error Failed to find a chrome / chromium binary to run. Add the puppeteer dependency to your project to resolve. Error: Cannot find module puppeteer imported from file:///Users/tragio, file:///Users/tragio/node_modules
Ah damn, sorry it's not something I can replicate so just trying to fix it based on what I think the issue is.
Could you try one thing for me, install the package as a global dependencies and try run it
npm install -g unlighthouse-puppeteer
unlighthouse-puppeteer --site example.com
Ah damn, sorry it's not something I can replicate so just trying to fix it based on what I think the issue is.
Could you try one thing for me, install the package as a global dependencies and try run it
npm install -g unlighthouse-puppeteer
unlighthouse-puppeteer --site example.com
Hmmm all the same, unfortunately. If you want send me DM on Twitter and we can do more tests and debug it easier.
Hi, I'm getting the very same error even after trying these alternatives
@harlan-zw does this help?
This might be caused by a different channel of Chrome being installed, so puppeteer cannot find it.
In my case, I have Chrome Dev installed.
I fixed the issue by defining the path to the Chrome executable in unlighthouse.config.ts
(your Chrome path may be different to this):
export default {
puppeteerOptions: {
executablePath: "C:\\Program Files (x86)\\Google\\Chrome Dev\\Application\\chrome.exe"
}
}
I've run into this problem on similar projects, so I've opened a PR on the chrome-launcher
library to add detection for Beta and Dev channels.
Make sure that you have Chrome installed and then in the same path you trigger the npx unlighthouse, do what @LachlanArthur has done.
It has worked for me