Implementation:Puppeteer Puppeteer Install Function
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Browser_Management, Package_Management |
| Last Updated | 2026-02-11 23:00 GMT |
Overview
Concrete tool for downloading and installing browser binaries into a local cache, provided by the @puppeteer/browsers package.
Description
The install() function downloads a browser archive, extracts it, and stores it in a cache directory. It supports all Puppeteer-supported browsers and platforms, with progress reporting and custom download mirrors.
Usage
Call this function to programmatically install browser binaries. For CLI usage, use npx puppeteer browsers install <browser>.
Code Reference
Source Location
- Repository: puppeteer
- File: packages/browsers/src/install.ts
- Lines: 278-306
- InstallOptions: lines 51-155
- uninstall: lines 534-547
Signature
async function install(options: InstallOptions & {unpack?: true}): Promise<InstalledBrowser>;
async function install(options: InstallOptions & {unpack: false}): Promise<string>;
Import
import {install, Browser} from '@puppeteer/browsers';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| options.cacheDir | string | Yes | Directory to store browser binaries |
| options.browser | Browser | Yes | Browser to install: 'chrome', 'firefox', 'chromium', 'chromedriver', 'chrome-headless-shell' |
| options.buildId | string | Yes | Version/build ID from resolveBuildId |
| options.platform | BrowserPlatform | No | Target platform (auto-detected if omitted) |
| options.downloadProgressCallback | Function | No | Progress reporting callback |
| options.unpack | boolean | No | Extract after download (default: true) |
| options.baseUrl | string | No | Custom download mirror URL |
Outputs
| Name | Type | Description |
|---|---|---|
| return | Promise<InstalledBrowser> | Object with executablePath, browser, buildId, platform, path |
Usage Examples
import {install, Browser, detectBrowserPlatform, resolveBuildId} from '@puppeteer/browsers';
const platform = detectBrowserPlatform();
const buildId = await resolveBuildId(Browser.CHROME, platform, 'stable');
const installedBrowser = await install({
cacheDir: '/home/user/.cache/puppeteer',
browser: Browser.CHROME,
buildId,
downloadProgressCallback: (downloadedBytes, totalBytes) => {
console.log(`${Math.round(downloadedBytes / totalBytes * 100)}%`);
},
});
console.log(`Installed to: ${installedBrowser.executablePath}`);
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment