harlan-zw / unlighthouse

Scan your entire site with Google Lighthouse in 2 minutes (on average). Open source, fully configurable with minimal setup.
https://unlighthouse.dev
MIT License
3.81k stars 110 forks source link

WSL2: Puppeteer uses wrong chrome instance (from windows instead of wsl) #242

Closed bernhardberger closed 2 hours ago

bernhardberger commented 2 hours ago

Details

npx unlighthouse --site https://xxxxx.at
[Unlighthouse 2:44:28 PM] ℹ Using system chrome located at: /mnt/c/Program Files/Google/Chrome/Application/chrome.exe.
✔ Successfully connected to https://xxxxx.at. (Status: 200).                     Unlighthouse 2:44:28 PM
ℹ Found /robots.txt, using entries. Sitemaps: 1, Groups: 1.                           Unlighthouse 2:44:28 PM
ℹ Discovered 71 routes from 1 sitemap.                                                Unlighthouse 2:44:28 PM
ℹ Disabling crawler mode as sitemap has been provided.                                Unlighthouse 2:44:28 PM   

[Unlighthouse 2:44:28 PM]  WARN  Dynamic sampling is in effect, some of your routes will not be scanned. To disable this behavior, set scanner.dynamicSampling to false.

/home/beb/.npm/_npx/944abecbf21dfffb/node_modules/puppeteer-cluster/dist/Cluster.js:146
                throw new Error(`Unable to launch browser for worker, error message: ${err.message}`);
                      ^

Error: Unable to launch browser for worker, error message: Failed to launch the browser process!

TROUBLESHOOTING: https://pptr.dev/troubleshooting

    at Cluster.<anonymous> (/home/beb/.npm/_npx/944abecbf21dfffb/node_modules/puppeteer-cluster/dist/Cluster.js:146:23)
    at Generator.throw (<anonymous>)
    at rejected (/home/beb/.npm/_npx/944abecbf21dfffb/node_modules/puppeteer-cluster/dist/Cluster.js:6:65)      
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v22.4.1

[Unlighthouse 2:44:28 PM] ℹ Using system chrome located at: /mnt/c/Program Files/Google/Chrome/Application/chrome.exe.

It should use

which google-chrome
/usr/bin/google-chrome

instead.

Is this configurable?

bernhardberger commented 2 hours ago

Solved:

unlighthouse.config.js:


export default {
 //...
  chrome: {
    useSystem: false,
  },
//...
}