chromium-location
v1.2.3
Published
Approximates the current location of the Chromium browser across platforms.
Maintainers
Readme
Approximates the current location of the Chromium browser across platforms.
chromium-location

- By default checks only
stable. - Supports macOS / Windows / Linux
- Works both as an ES module or CommonJS
New in this version:
- Honors environment overrides:
CHROMIUM_BINARY,CHROME_BINARY - Optional helper to throw with a friendly install guide when nothing is found
- After you run
npx @puppeteer/browsers install chromiumonce, we auto-detect Chromium from Puppeteer's cache on all platforms (no env vars needed) - Cross-platform version API that does not execute the browser by default
Support table
This table lists the default locations where Chromium is typically installed for each supported platform and channel. By default, only the Stable channel is checked.
Returns the first existing path found (given selected channels), or null if none are found.
Usage
Via Node.js (strict by default):
// Returns the path to Chromium as a string.
import chromiumLocation, {
locateChromiumOrExplain,
getInstallGuidance,
getChromiumVersion
} from 'chromium-location'
// Strict (Stable only)
console.log(chromiumLocation())
// => "/Applications/Chromium.app/Contents/MacOS/Chromium" or null
// Enable fallback (Stable / alternative binaries on Linux)
console.log(chromiumLocation(true))
// Throw with a friendly, copy-pasteable guide when not found
try {
const path = locateChromiumOrExplain({allowFallback: true})
console.log(path)
// Cross-platform version (no exec by default)
const v = getChromiumVersion(path)
console.log(v) // e.g. "120.0.6099.109" or null
// Opt-in: allow executing the binary to fetch version on platforms without metadata (e.g. Linux)
const v2 = getChromiumVersion(path, {allowExec: true})
console.log(v2)
} catch (e) {
console.error(String(e))
// Or print getInstallGuidance() explicitly
}Via CLI:
npx chromium-location
# Respect Puppeteer cache (after you install once):
npx @puppeteer/browsers install chromium
npx chromium-location
# Respect environment overrides
CHROMIUM_BINARY=/custom/path/to/chromium npx chromium-locationEnvironment overrides
If any of these environment variables are set and point to an existing binary, they take precedence:
CHROMIUM_BINARYCHROME_BINARY
When nothing is found
The helper returns actionable guidance:
We couldn't find a Chromium browser on this machine.
Here's the fastest way to get set up:
1) Install Chromium via Puppeteer Browsers (recommended)
npx @puppeteer/browsers install chromium
Then re-run your command — we'll detect it automatically.
Alternatively, install Chromium using your OS package manager and re-run.API
default export locateChromium(allowFallback?: boolean): string | null- Returns the first existing path among the selected channels or
null. - When
allowFallbackistrue, checks the stable locations and common alternatives per-platform.
- Returns the first existing path among the selected channels or
locateChromiumOrExplain(options?: boolean | { allowFallback?: boolean }): string- Returns a path if found, otherwise throws an
Errorwith a friendly installation guide.
- Returns a path if found, otherwise throws an
getChromiumVersion(bin: string, opts?: { allowExec?: boolean }): string | null- Cross-platform version resolver that does not execute the browser by default.
- Windows: reads PE file metadata via PowerShell (no GUI spawn).
- macOS: reads
Info.plist(no GUI spawn). - Linux/other: attempts to infer from Puppeteer cache path; otherwise returns
nullunlessallowExecistrue.
getInstallGuidance(): string- Returns the same guidance text used by
locateChromiumOrExplain().
- Returns the same guidance text used by
Related projects
- brave-location
- chrome-location2
- edge-location
- firefox-location2
- opera-location2
- vivaldi-location2
- yandex-location
- waterfox-location
Acknowledgements
This project is adapted from chrome-location.
License
MIT (c) Cezar Augusto.
