Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

To install Puppeteer, make sure Node.js (an active LTS release) and npm are installed, then run npm install puppeteer inside your project folder. That single command pulls in the Puppeteer library and automatically downloads a matching Chrome for Testing build, so you can import Puppeteer in a script and start automating Chrome right away. The rest of this guide walks through the prerequisites, the difference between puppeteer and puppeteer-core, a complete first script, environment configuration, and how to fix the most common install errors.
Puppeteer is a Node.js library, so a working Node.js installation is the only hard requirement. npm ships with Node.js, so installing one gives you both.
Confirm both are available by checking their versions in a terminal. If the commands print version numbers, you are ready to install Puppeteer.
node -v
npm -vThere are two packages on npm, and choosing the right one saves you a lot of confusion later.
For most people, the standard package is the right call.
npm install puppeteerIf you want the library without the bundled browser, install the core variant instead.
npm install puppeteer-coreBefore installing the package, create a project folder and initialize it so npm has a package.json to write to. Follow these pointers in order.
The first three steps look like this on the command line.
mkdir puppeteer-project
cd puppeteer-project
npm init -y
npm install puppeteerA first script is the fastest way to confirm the install worked. The example below launches a browser, opens a page, navigates to a URL, captures a screenshot, and closes the browser. Save it as index.js in your project folder.
import puppeteer from 'puppeteer';
(async () => {
const browser = await puppeteer.launch(); // new headless mode by default
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'example.png' });
await browser.close();
})();Run it with the Node.js runtime, then check your folder for the generated image.
node index.jsPuppeteer supports both module systems, and the only difference is how you load it. The script above uses ESM, which requires "type": "module" in package.json (or a .mjs file extension).
import puppeteer from 'puppeteer';If your project stays on CommonJS (the default when "type" is absent), use require instead. Everything after the import line is identical.
const puppeteer = require('puppeteer');Puppeteer reads a handful of environment variables that control how and where it downloads the browser. These are the ones you will reach for most often.
# Skip downloading Chrome on install
export PUPPETEER_SKIP_DOWNLOAD=true
# Relocate the browser cache
export PUPPETEER_CACHE_DIR="$HOME/.cache/puppeteer"For settings you want committed with the project rather than exported in a shell, add a .puppeteerrc.cjs file at the project root. Puppeteer walks up the directory tree to find it, and you should re-install after changing it.
const { join } = require('path');
module.exports = {
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};One thing you do not need to configure is TypeScript support, Puppeteer ships its own type definitions, so a TypeScript project gets full type checking without any extra @types package.
sudo apt-get update
sudo apt-get install -y libnss3 libatk-bridge2.0-0 libcups2 \
libxkbcommon0 libgtk-3-0 libasound2A local install is perfect for writing and debugging scripts, but it only covers the single Chrome build on your machine. When you need to confirm that your automation behaves the same across many browser and OS combinations, the next step is to point Puppeteer at a cloud grid. With TestMu AI Puppeteer you connect the same scripts to thousands of real browser and OS configurations using a remote endpoint, no local browser binaries required. It is the natural follow-on once your first script runs locally and you want broader coverage.
The current Puppeteer (v24.x line) requires Node.js 22.12 or newer. The safest choice is to install an active Node.js LTS release and confirm it with node -v before running npm install puppeteer.
The puppeteer package automatically downloads a compatible Chrome for Testing build during install, so it works out of the box. The puppeteer-core package installs the library only, with no browser download, and expects you to provide an executablePath or channel, or to connect to a remote browser endpoint such as a cloud grid.
Yes. Running npm install puppeteer downloads a matching Chrome for Testing build (and chrome-headless-shell) into the Puppeteer cache directory, which defaults to the .cache/puppeteer folder in your home directory. This is why the first install is larger than a typical npm package.
Set the environment variable PUPPETEER_SKIP_DOWNLOAD=true before installing, or install puppeteer-core instead. Both approaches skip the browser download, which is useful in CI images that already ship Chrome or when you intend to connect to a remote browser.
On a minimal Linux or Docker image the downloaded Chrome is usually missing shared system libraries. Installing packages such as libnss3, libatk-bridge2.0-0, libcups2, libxkbcommon0, libgtk-3-0 and libasound2 resolves the error. In containers you typically also add the --disable-dev-shm-usage and --no-sandbox launch arguments.
Puppeteer is free and open source, and it ships its own TypeScript type definitions, so you do not need a separate @types/puppeteer package on current versions. You can import it directly into a TypeScript project and get full type checking.
KaneAI - Testing Assistant
World’s first AI-Native E2E testing agent.

TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance