Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run a Puppeteer script locally, install Node.js 22.12 or later, install the puppeteer package, save a JavaScript file, and run it with node. The standard package downloads a compatible Chrome for Testing browser; the script launches it, opens a page, navigates to a URL, and can read or interact with the page. Puppeteer’s documentation describes version 25.12.0 in its current guides; check the live system requirements before installing, particularly on Linux.

What you need before running Puppeteer

Puppeteer is a JavaScript library for controlling Chrome or Firefox through browser automation protocols. The usual workflow is to launch or connect to a browser, create a page, and use Puppeteer’s API to interact with it. This guide uses the simpler local setup: Node.js plus a browser installed for Puppeteer.

  • Node.js: the Puppeteer system requirements page currently lists Node.js 22.12 or later. Confirm the requirement on the live page because it can change between releases.
  • A project folder: use a dedicated folder so the package and script are easy to manage.
  • Network access during setup: the standard puppeteer install downloads a compatible browser. A package install can therefore take longer and use more disk space than installing a JavaScript-only library.
  • Linux system libraries, when applicable: a successful npm install does not guarantee the browser can launch. Linux may need platform dependencies listed in Puppeteer’s system requirements.

Check your Node.js version from a terminal:

node --version
npm --version

If node is not recognized, install Node.js or correct your PATH before continuing. The version printed by node --version should meet the current Puppeteer requirement.

Choose the right Puppeteer package

Package Browser setup Use it when
puppeteer Downloads a compatible Chrome for Testing browser during installation. You want the ordinary local workflow with sensible browser defaults.
puppeteer-core Does not download Chrome. You supply or connect to a browser yourself. You manage a browser installation, use a remote browser, or need explicit control over the browser endpoint.

For a first script, install puppeteer. Choose puppeteer-core only when you have a plan for providing the browser executable or remote connection details. The official installation guide documents the package installation behavior; its URL is currently under the Next documentation path, so check the current stable instructions if the page or commands have changed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Apple 2026 MacBook Neo 13-inch Laptop with A18 Pro chip: Built for AI and Apple Intelligence, Liquid Retina Display, 8GB Unified Memory, 256GB SSD Storage, 1080p FaceTime HD Camera; Blush
  • AN AMAZING MAC AT A SURPRISING PRICE — With an incredibly portable and durable aluminum design, up to 16 hours of battery life,* and the A18 Pro chip, MacBook Neo is ready to go wherever school takes you.
  • FOUR STUNNING COLORS. ONE DURABLE DESIGN — Choose from four beautiful colors — Silver, Blush, Citrus, or Indigo — each with a color-coordinated keyboard. And MacBook Neo is made with a durable recycled aluminum enclosure that helps it reach 60 percent recycled content by weight — the most ever in any Apple product.*
  • FLY THROUGH EVERYDAY ASSIGNMENTS — Whether you’re cramming for finals, using Apple Intelligence* to summarize class notes, creating presentations, or even playing the latest Apple Arcade game,* MacBook Neo delivers the performance and AI capabilities you need to get things done.
  • UP TO 16 HOURS OF BATTERY LIFE — MacBook Neo delivers all day battery life, so you can power through from early morning classes to late night study sessions without worrying about plugging in.
  • A VIBRANT 13-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Neo supports 1 billion colors, so photos and videos pop and text is crisp for easy reading.

Install Puppeteer and create a project

  1. Create and enter a folder:
    mkdir puppeteer-demo
    cd puppeteer-demo
  2. Initialize npm and install Puppeteer:
    npm init -y
    npm i puppeteer

    The package manager creates package.json and installs Puppeteer with its compatible browser. If your environment suppresses package install scripts or browser downloads, the library may install without the browser expected by the default launch; see the troubleshooting section.

  3. Create an ES module script: save the following as example.mjs in the project folder.
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();

try {
  const page = await browser.newPage();
  await page.goto('https://example.com');
  console.log(await page.title());
} finally {
  await browser.close();
}

The .mjs extension tells Node.js to treat this file as an ES module, which supports the import syntax shown. The finally block closes the browser whether navigation succeeds or throws an error, preventing a leftover browser process in the common failure case.

Run the script and understand the result

From the same project directory, run:

node example.mjs

Puppeteer launches a headless browser by default, so no browser window is expected. If navigation succeeds, the terminal prints the page title, typically Example Domain. If you get an error instead, note whether it happens during browser launch, navigation, or a later page action: those are different troubleshooting layers.

Use CommonJS if your project already uses it

If the project uses CommonJS, create example.cjs and use require rather than mixing it with the ES module example:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com');
    console.log(await page.title());
  } finally {
    await browser.close();
  }
})();

Run it with node example.cjs. The file extension makes the module format explicit. Alternatively, configure the project as an ES module and use .js with import; do not combine module formats accidentally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose visible Chrome, regular headless, or headless shell

Mode How to select it What to expect
Regular headless puppeteer.launch() (the default) Runs without a visible browser window. Useful for routine scripts and server execution.
Visible browser puppeteer.launch({ headless: false }) Opens a regular Chrome window so you can watch navigation and interaction while debugging. A machine without a graphical display may not support this setup as-is.
Headless shell puppeteer.launch({ headless: 'shell' }) Uses the separate Chrome headless shell. Puppeteer documents it as potentially more performant for automation when the full regular Chrome feature set is not needed; it is not a universal replacement for regular Chrome.

To watch the example, replace the launch line with const browser = await puppeteer.launch({ headless: false });. See Puppeteer’s guide to headless modes for details on differences and configuration.

Rank #2
Sale
Apple 2026 MacBook Air 13-inch Laptop with M5 chip: Built for AI, 13.6-inch Liquid Retina Display, 16GB Unified Memory, 512GB SSD, 12MP Center Stage Camera, Touch ID, Wi-Fi 7; Midnight
  • BUILT FOR COLLEGE. AND BEYOND — MacBook Air with the M5 chip packs blazing speed and powerful AI capabilities into an incredibly portable design. And with up to 18 hours of battery life,* this thin and light powerhouse is ready to take on almost any major, just about anywhere.
  • TEAR THROUGH TOUGH ASSIGNMENTS — With its faster CPU and unified memory, the M5 chip delivers even more performance and fluidity across apps, making multitasking and creative workflows smooth and responsive. A powerful Neural Engine and next-generation GPU with Neural Accelerators give you a powerful platform for AI.
  • MAKE QUICK WORK OF YOUR TO-DO LIST — Apple Intelligence helps you write, express yourself, and get things done effortlessly — whether it’s for school or everyday life. With groundbreaking privacy protections, it gives you peace of mind that no one else can access your data — not even Apple.*
  • UP TO 18 HOURS OF BATTERY LIFE — MacBook Air delivers incredible battery life with amazing performance, so you can power through a full day of classes without worrying about plugging in.
  • A BRILLIANT 13.6-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Air supports 1 billion colors, making photos and videos pop with rich contrast and sharp detail, and text appears supercrisp. So everything — from class presentations to movies to games — looks truly stunning.

Make the script more useful

Once the basic run works, add one operation at a time so an error is easier to locate. For example, inspect a heading or take a local screenshot:

const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
console.log(await page.locator('h1').innerText());
await page.screenshot({ path: 'page.png' });

This snippet belongs inside the existing try block after launching the browser. Puppeteer’s page APIs can wait for selectors, click elements, type text, read content, and capture screenshots. Prefer waiting for the specific condition your next operation needs rather than adding arbitrary delays; pages that load data asynchronously may need an explicit selector wait or other suitable wait condition.

Keep cleanup reliable

  • Keep browser shutdown in a finally block so an exception does not leave the process running.
  • When adding multiple pages, close them or close the browser as part of the same cleanup path.
  • For a long-running service, handle process shutdown deliberately rather than relying on the operating system to clean up browser processes.

Run Puppeteer on a server or connect to another browser

Puppeteer is the automation library, not a hosting service. You can run the Node script on a server or in a CI environment, but that environment still needs a compatible browser and the operating-system libraries it requires. Headless mode is the usual starting point where there is no desktop display. On Linux, compare installed libraries with Puppeteer’s system requirements when Chrome exits before the script reaches the page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A separate, advanced arrangement is to connect to a browser that already exists. The browser-in-browser guide describes running Puppeteer in a browser context; it cannot launch or download a browser through Node APIs and instead connects to an existing browser using a WebSocket endpoint. That is not the ordinary local Node workflow. Use it only when you specifically have a browser endpoint and understand how it is provisioned and secured. Puppeteer itself does not provide managed hosting.

Troubleshoot common Puppeteer failures

“Could not find Chrome” or browser executable missing

  • Check that you installed puppeteer, not puppeteer-core, if you expect the package to provide a browser.
  • Check whether your package manager or deployment setup blocked Puppeteer’s install script or browser download.
  • Consult the current installation guide for the appropriate browser-install command for your version and environment.
  • If you intentionally use puppeteer-core, supply a valid executable path or connect to the browser endpoint you manage.

Chrome installs but will not launch on Linux

This often points to operating-system dependencies rather than a JavaScript syntax problem. Compare the libraries installed on the machine with Puppeteer’s system requirements, including the Linux-specific dependencies. Also check the browser’s standard error output; dumpio: true forwards browser process output to Node:

Rank #3
HP OmniBook 3 17.3 inch Laptop PC, FHD Display, AMD Ryzen 3 30, 8 GB RAM, 512 GB SSD, AMD Radeon 610M Graphics, Windows 11 Home, Mica Silver, 17-dp0199nr
  • FULL HD IPS DISPLAY - Enjoy vibrant, crystal-clear images with 178-degree wide-viewing angles
  • AMD RYZEN 3 30 PROCESSOR - Everyday performance you can count on; Multitask, stream, game casually, and edit photos smoothly with responsive power and vibrant HDR visuals
  • ENJOY UP TO 14 HOURS AND 15 MINUTES OF BATTERY LIFE - HP Fast Charge restores battery from 0 to 50% in approximately 45 minutes
  • AMD RADEON 610M GRAPHICS - Experience smooth entertainment; Built for streaming and multitasking, enjoy realistic visuals and efficient performance for work and play
  • STORAGE AND MEMORY - 512 GB PCIe NVMe M.2 SSD offers fast speed and efficient storage; and 8 GB LPDDR5 RAM memory boosts performance with higher bandwidth
const browser = await puppeteer.launch({ dumpio: true });

The script runs but you cannot see a window

That is expected in the default headless mode. Set headless: false on a machine with a graphical environment to inspect the run. To slow automation steps while watching them, Puppeteer supports the slowMo launch option.

Page console messages do not appear in the terminal

Browser-page console output is separate from Node’s own console.log. Forward it explicitly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.on('console', message => console.log('PAGE:', message.text()));

Register this after creating page and before navigating if you need to catch messages emitted during initial page load.

A Puppeteer call appears stuck

First establish which operation is waiting: launch, navigation, selector wait, or another protocol call. Add logging around those boundaries, reproduce with a visible browser if possible, and consult the official debugging guide for pending-call diagnostics and protocol logging. Protocol logs can be verbose and may include sensitive page or request data, so avoid sharing them publicly without reviewing and redacting them.

The page loads but the script reads the wrong content

Navigation completion does not always mean an application has finished rendering the content you need. Wait for a meaningful selector or page condition, then read or click the element. If the selector never appears, confirm it still matches the page and whether the content is accessible in that browser session.

Rank #4
Dell 15.6 Laptop, FHD, Intel Core 3 100U, 8 GB RAM, Windows 11 Home
  • Effortlessly chic. Always efficient. Finish your to-do list in no time with the Dell 15, built for everyday computing with Intel Core 3 processor.
  • Designed for easy learning: Energy-efficient batteries and Express Charge support extend your focus and productivity.
  • Stay connected to what you love: Spend more screen time on the things you enjoy with Dell ComfortView software that helps reduce harmful blue light emissions to keep your eyes comfortable over extended viewing times.
  • Type with ease: Write and calculate quickly with roomy keypads, separate numeric keypad and calculator hotkey.
  • Ergonomic support: Keep your wrists comfortable with lifted hinges that provide an ergonomic typing angle.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a screenshot rather than browser automation, ScreenshotNeo is a website screenshot API and MCP server. It returns PNG, JPEG, WebP, or PDF from a URL. One GET request is enough for a basic capture:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation for the request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up free for ScreenshotNeo.

Frequently Asked Questions

Can I run Puppeteer without installing Chrome myself?

Yes. For the standard local setup, install the `puppeteer` package; it downloads a compatible Chrome for Testing browser. `puppeteer-core` does not.

Does Puppeteer work with Firefox?

Puppeteer’s documentation describes control of Chrome or Firefox, but the beginner installation and example here use the standard Chrome download workflow. Consult the current documentation for browser-specific setup.

Can I run a Puppeteer script by double-clicking the file?

Use Node.js from a terminal, such as `node example.mjs`, so the correct runtime, project dependencies, and error output are available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.