unlighthouse
unlighthouse copied to clipboard
Error: An `executablePath` or `channel` must be specified for `puppeteer-core`
Describe the bug
When unlighthouse is installed with npm, chromium will never be installed on-the-fly.
Reproduction
npm install unlighthouse --save-devnpx unlighthouse --site <site>- error
System / Nuxt Info
System:
OS: Linux 6.11 Fedora Linux 41 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
Memory: 5.91 GB / 15.55 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 22.11.0 - /usr/bin/node
npm: 10.9.1 - /usr/local/bin/npm
I'll need the entire stack trace to debug this or a valid reproduction, if you can run it with the --debug flag I'll have more info.
Seeing the same issue on Windows with Bun
❯ bunx unlighthouse --debug
⚙ Starting Unlighthouse at root: F:\VS Projects\Ogma3\Ogma3 cwd: F:\VS Projects\Ogma3\Ogma3 Unlighthouse 10:58:50
⚙ Discovered config definition { site: 'https://localhost:5001', scanner: { exclude: [ '/rss/*', '/admin/*' ] } } Unlighthouse 10:58:50
ℹ Using puppeteer dependency for Chrome. Unlighthouse 10:58:50
file:///F:/VS%20Projects/Ogma3/Ogma3/node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js:15
throw new Error(message);
^
Error: An `executablePath` or `channel` must be specified for `puppeteer-core`
at assert (file:///F:/VS%20Projects/Ogma3/Ogma3/node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js:15:15)
at ChromeLauncher.computeLaunchArguments (file:///F:/VS%20Projects/Ogma3/Ogma3/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:82:13)
at async ChromeLauncher.launch (file:///F:/VS%20Projects/Ogma3/Ogma3/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js:48:28)
at async resolveUserConfig (file:///F:/VS%20Projects/Ogma3/Ogma3/node_modules/@unlighthouse/core/dist/index.mjs:1805:20)
at async createUnlighthouse (file:///F:/VS%20Projects/Ogma3/Ogma3/node_modules/@unlighthouse/core/dist/index.mjs:1916:26)
at async run (file:///F:/VS%20Projects/Ogma3/Ogma3/node_modules/@unlighthouse/cli/dist/cli.mjs:19:24)
Node.js v22.12.0
Had the same problem when updating. Here's a new unlighthouse.config.ts that should work:
import { defineUnlighthouseConfig } from 'unlighthouse/config'
const main = async () => {
const chromium = require("@sparticuz/chromium");
const executablePath = await chromium.executablePath();
chromium.setGraphicsMode = false;
return defineUnlighthouseConfig({
// … your config
})
}
await main()
List of package.json deps:
"@sparticuz/chromium": "133.0.0","unlighthouse": "0.16.2"
Env:
$ git:[dev]
nvm use 22
Now using node v22.14.0 (npm v10.9.2)
Bump => Better npm support is needed
I found an interesting fix for this. If within my project I remove puppeteer/puppeteer-core as well as unlighthouse - Completely removing them from my project and package.json, the npx script actually runs fine from within that same directory?
Not exactly sure where it's getting it's deps from, since I don't have any global packages installed, but it's running, and since I'm not using this for anything more than a one off thing at the moment this works enough well for me.
Leaving this here as it may help someone else