puppeteer-core refuses to launch without a browser path or channel
An `executablePath` or `channel` must be specified for `puppeteer-core`Short answer
puppeteer-core never downloads a browser, so launch needs to be told which one to use. Pass executablePath with the path of a Chrome or Chromium you installed, or channel when Chrome sits in its standard location. Or switch to the puppeteer package, which downloads Chrome for Testing when you install it.
Fix it fast
1Find out which cause you have
Check which Puppeteer package the project really imports. The error only comes from puppeteer-core.
grep -rn "puppeteer" package.json grep -rn "from 'puppeteer\|require('puppeteer" src/2Match what you see, then jump to its fix
- 1
The import is puppeteer-core and launch() has no executablePath or channelpuppeteer-core is used and no browser is namedFix - 2
No other part of the project depends on a system ChromeThe project only needs a browser it can download itselfFix - 3
The same code works on one machine and fails in Docker or CIThe path is set by an environment variable that is empty in this environmentFix
- 1
What does the error look like?
An `executablePath` or `channel` must be specified for `puppeteer-core`
Cause 1 of 3
puppeteer-core is used and no browser is named
1Check
The Puppeteer docs say puppeteer-core does not download Chrome when installed, and you launch it with an explicit executablePath, or with channel when the browser is in a standard location.
which google-chrome-stable chromium chromium-browser2Fix
Pass the path of a browser that exists on the machine, or a channel.
import puppeteer from 'puppeteer-core';
const browser = await puppeteer.launch({
executablePath: '/usr/bin/google-chrome-stable',
// or: channel: 'chrome',
});3Verify
The script opens a page and prints its title.
node -e "import('puppeteer-core').then(async p => { const b = await p.default.launch({ executablePath: '/usr/bin/google-chrome-stable' }); console.log(await b.version()); await b.close(); })"Confirmed by pptr.dev
Cause 2 of 3
The project only needs a browser it can download itself
1Check
The full puppeteer package downloads a recent Chrome for Testing when you install it and keeps it in the cache folder under your home directory.
ls ~/.cache/puppeteer2Fix
Replace puppeteer-core with puppeteer, and import that. Then launch needs no path.
npm uninstall puppeteer-core
npm install puppeteer3Verify
launch() works with no options.
node -e "import('puppeteer').then(async p => { const b = await p.default.launch(); console.log(await b.version()); await b.close(); })"Confirmed by pptr.dev
Cause 3 of 3
The path is set by an environment variable that is empty in this environment
1Check
The Alpine Docker example in the Puppeteer docs sets PUPPETEER_EXECUTABLE_PATH to a system Chromium, and code can read it from the environment. A variable that is unset in CI leaves the path undefined.
echo "$PUPPETEER_EXECUTABLE_PATH"2Fix
Set the variable in the image or pipeline, or fall back to a fixed path in code.
const browser = await puppeteer.launch({
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || '/usr/bin/chromium-browser',
});3Verify
Run the same container and print the browser version.
docker run --rm my-image node check-browser.mjsConfirmed by pptr.dev
How do I stop it coming back?
- Pick one package on purpose: puppeteer for a self-contained browser, puppeteer-core for a browser you manage.
- Keep the browser path in one environment variable with the same name in every environment.
- Print the browser version at start-up so a wrong path fails early and loudly.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Puppeteer cannot start Chrome on a Linux server
error while loading shared libraries: libnss3.so: cannot open shared object file
Puppeteer prints the real reason below the first line, so read that.
4 causes, each with a fixBack end
Application Load Balancer returns 502 for a Node.js target
HTTPCode_ELB_502_Count
An ALB returns 502 when the target gives it something it cannot use: a refused or reset connection, a connection closed mid-request, a bad response, or a header over 32 K.
4 causes, each with a fixBack end
corepack enable fails: permission denied while creating the pnpm link
Internal Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm'
corepack enable writes small link files for yarn and pnpm next to your node binary.
2 causes, each with a fixBack end
Create React App says Node is too old, and npm will not run on the new one
npm does not support Node.js v10.19.0
The shell is running an old Node.js that is below the version Create React App needs.
3 causes, each with a fixBack end
firebase deploy cannot load your functions: user code failed to load
Functions codebase could not be analyzed successfully. It may have a syntax or runtime error
The Firebase CLI loads your functions code on your machine before it deploys, to learn which functions exist.
4 causes, each with a fixBack end
firebase deploy stops because the predeploy lint step failed
Error: There was an error deploying functions
The predeploy hook in firebase.json runs npm run lint before every deploy, and a failing hook cancels the deploy.
3 causes, each with a fix