Skip to main content
Version: 25.2.0

Installation

To use Puppeteer in your project, run:

npm i puppeteer

When you install Puppeteer, it automatically downloads a recent version of Chrome for Testing (~170MB macOS, ~282MB Linux, ~280MB Windows) and a chrome-headless-shell binary (starting with Puppeteer v21.6.0) that is guaranteed to work with Puppeteer. The browser is downloaded to the $HOME/.cache/puppeteer folder by default (starting with Puppeteer v19.0.0). See configuration for configuration options and environmental variables to control the download behavior.

caution

Automatic downloads can be blocked

Many modern package managers (such as npm under the new RFC, pnpm, Yarn Berry, Bun, and Deno) block dependency install scripts by default. If your package manager is configured to block these scripts, the automatic download will be skipped, and running Puppeteer will throw an error: Could not find Chrome (ver. ...).

To resolve this, you can:

  1. Manually install the browser after package installation by running:
    npx puppeteer browsers install
  2. Opt back in to running the postinstall scripts for Puppeteer (e.g. for npm, by adding "puppeteer" to "allowScripts" in your package.json):
    {
    "allowScripts": {
    "puppeteer": true
    }
    }

For every release since v1.7.0 we publish two packages:

puppeteer is a product for browser automation. When installed, it downloads a version of Chrome, which it then drives using puppeteer-core. Being an end-user product, puppeteer automates several workflows using reasonable defaults that can be customized.

puppeteer-core is a library to help drive anything that supports DevTools protocol. Being a library, puppeteer-core is fully driven through its programmatic interface implying no defaults are assumed and puppeteer-core will not download Chrome when installed.

You should use puppeteer-core if you are connecting to a remote browser or managing browsers yourself. If you are managing browsers yourself, you will need to call puppeteer.launch with an explicit executablePath (or channel if it's installed in a standard location).

When using puppeteer-core, remember to change the import:

import puppeteer from 'puppeteer-core';