get-chrome-from-puppeteer
v1.3.0
Published
Install Chrome for Testing via @puppeteer/browsers and return its executable path
Maintainers
Readme
get-chrome-from-puppeteer
Install Chrome for Testing via @puppeteer/browsers and return its executable path.
Install
npm install get-chrome-from-puppeteerCLI
# Get Chrome stable (default) — prints the executable path
npx get-chrome-from-puppeteer
# Specific version
npx get-chrome-from-puppeteer 130
npx get-chrome-from-puppeteer 130.0.6723.58
# Channels
npx get-chrome-from-puppeteer canary
npx get-chrome-from-puppeteer beta
# JSON output
npx get-chrome-from-puppeteer --json
# Re-install if newer build available
npx get-chrome-from-puppeteer --update
# Install system dependencies (Debian/Ubuntu, requires root)
npx get-chrome-from-puppeteer --install-deps
# Custom cache directory
npx get-chrome-from-puppeteer --cache-dir /tmp/browsers
# Custom download mirror
npx get-chrome-from-puppeteer --base-url https://my-mirror.example.com
# Quiet mode (no progress bar)
npx get-chrome-from-puppeteer -q
# Only print path if already installed (no download)
npx get-chrome-from-puppeteer --path-only
# Install Chromium instead of Chrome for Testing
npx get-chrome-from-puppeteer --chromiumShell integration
# Use in scripts
CHROME=$(npx -y get-chrome-from-puppeteer)
$CHROME --headless --dump-dom https://example.comOptions
| Option | Description |
| -------------------- | ------------------------------------------------------------------------------------------------------- |
| [version] | Chrome version: stable (default), canary, beta, dev, milestone (130), exact (130.0.6723.58) |
| --json | Output as JSON { executablePath, buildId } |
| --update | Re-install if a newer build is available |
| --install-deps | Install system dependencies (Debian/Ubuntu, requires root) |
| --cache-dir <path> | Custom cache directory |
| --base-url <url> | Custom download mirror URL |
| --quiet, -q | Suppress download progress output |
| --path-only | Only print path if installed, don't download |
| --chromium | Install Chromium instead of Chrome for Testing |
| --help, -h | Show help |
| --version, -v | Show package version |
Environment variables
| Variable | Description |
| ------------------------ | ---------------------------------------------------- |
| GET_CHROME_VERSION | Chrome version (same as positional arg) |
| GET_CHROME_UPDATE | Set to 1 or true to re-install if newer |
| GET_CHROME_INSTALL_DEPS| Set to 1 or true to install system deps |
| GET_CHROME_CACHE_DIR | Custom cache directory |
| GET_CHROME_BASE_URL | Custom download mirror URL |
| GET_CHROME_QUIET | Set to 1 or true to suppress progress |
| GET_CHROME_PATH_ONLY | Set to 1 or true to skip download |
| GET_CHROME_CHROMIUM | Set to 1 or true to install Chromium |
| GET_CHROME_JSON | Set to 1 or true for JSON output |
Programmatic API
import { getChrome } from "get-chrome-from-puppeteer";
const { executablePath, buildId } = await getChrome();
console.log(executablePath);
// /home/user/.cache/puppeteer-browsers/chrome/linux-130.0.6723.58/chrome-linux64/chrome
// With options
const result = await getChrome({
version: "canary",
update: true,
installDeps: true,
cacheDir: "/tmp/browsers",
});getChrome(options?): Promise<GetChromeResult>
Options
| Option | Type | Default | Description |
| ---------- | --------- | -------------- | ------------------------------------------------ |
| version | string | "stable" | Chrome version tag, milestone, or exact build ID |
| update | boolean | false | Re-install if a newer build is available |
| installDeps | boolean | false | Install system dependencies (Debian/Ubuntu, requires root) |
| cacheDir | string | system default | Custom cache directory |
| baseUrl | string | Google's CDN | Custom download mirror URL |
| quiet | boolean | false | Suppress download progress output |
| pathOnly | boolean | false | Only return path if installed, don't download |
| chromium | boolean | false | Install Chromium instead of Chrome for Testing |
Result
| Field | Type | Description |
| ---------------- | -------- | ----------------------------------------------------------------------------------- |
| executablePath | string | Absolute path to the Chrome executable |
| buildId | string | Resolved build ID (e.g. "130.0.6723.58") |
License
MIT
