Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
browser automation

How to Install Puppeteer and Chromium in Laravel Sail

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

Use Sail’s application container for every Node command. From an existing Laravel Sail project, run ./vendor/bin/sail npm install puppeteer. The standard puppeteer package downloads a compatible Chrome for Testing build automatically. If you prefer distribution-managed Chromium, install it in the laravel.test image, verify its real executable path, and pass that path to Puppeteer. The complete setup depends on your Sail image’s Linux distribution, user, CPU architecture and Puppeteer version, so inspect the generated Dockerfile rather than copying an unverified path or package list.

Choose the browser model first

There are two local-browser approaches in Sail. Puppeteer’s normal package manages a browser for you; a system Chromium installation is managed by your Dockerfile and by you at runtime.

Approach What gets installed Advantages Responsibilities
Puppeteer-managed Chrome for Testing puppeteer plus its downloaded browser The browser revision is selected for Puppeteer compatibility. Allow the install script to download the browser, keep its cache available to the runtime user, and provide Linux libraries.
System Chromium Your base image’s Chromium package and dependencies Uses a distribution-managed browser and update process. Find the actual binary, maintain libraries and assess Chromium/Puppeteer compatibility yourself.
Externally managed browser puppeteer-core connected to a remote or separately managed browser Browser lifecycle can be separated from the PHP application image. Provide the endpoint or executable and manage its security, versions and availability.

The official installation guide says that installing Puppeteer automatically downloads a recent Chrome for Testing and, from Puppeteer v21.6.0, a chrome-headless-shell binary guaranteed to work with Puppeteer (Puppeteer installation documentation). This is not the same as installing Debian’s chromium package.

Check the Sail project and container

  1. Open compose.yaml and locate the laravel.test service. Note its build context, Dockerfile and any NODE_VERSION argument. Current Sail documentation uses Node 24 by default and allows that build argument to be changed.
  2. Run commands through Sail, not through an unrelated host Node installation:
    ./vendor/bin/sail node --version
    ./vendor/bin/sail npm --version

    If you configured the Sail shell alias, sail can replace ./vendor/bin/sail.

  3. Start the services if they are not running:
    ./vendor/bin/sail up -d

Sail is Docker configuration and is intended to be customized; Laravel documents that you can customize nearly everything about it (Laravel Sail documentation).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Amazon Basics Wired QWERTY Keyboard, Works with Windows, Plug and Play, Easy to Use with Media Control, Full-Sized, Black
  • KEYBOARD: The keyboard works for Windows with hot keys that enable easy access to Media, My Computer, Mute, Volume up/down, and Calculator
  • EASY SETUP: Experience simple installation with the USB wired connection
  • VERSATILE COMPATIBILITY: This keyboard is designed to work with multiple Windows versions, including Vista, 7, 8, 10 offering broad compatibility across devices.
  • SLEEK DESIGN: The elegant black color of the wired keyboard complements your tech and decor, adding a stylish and cohesive look to any setup without sacrificing function.
  • FULL-SIZED CONVENIENCE: The standard QWERTY layout of this keyboard set offers a familiar typing experience, ideal for both professional tasks and personal use.

Install Puppeteer’s compatible browser (recommended path)

  1. From the project directory, add the dependency inside the application container:
    ./vendor/bin/sail npm install puppeteer

    This updates package.json and the lock file. Commit both so another image build installs the same dependency graph.

  2. Build dependency installation into your normal image workflow. If your Dockerfile runs npm install or npm ci during a build, ensure Puppeteer’s install script is permitted. Package-manager policies such as ignore-scripts=true can prevent the browser download.
  3. If the install script was skipped, download the browser explicitly inside the container:
    ./vendor/bin/sail npx puppeteer browsers install
  4. Use Puppeteer in application code. For example, create resources/js/capture.mjs:
    import puppeteer from 'puppeteer';
    
    const browser = await puppeteer.launch({
      headless: true,
    });
    
    try {
      const page = await browser.newPage();
      await page.goto('https://example.com', { waitUntil: 'networkidle2' });
      await page.screenshot({ path: '/tmp/example.png', fullPage: true });
    } finally {
      await browser.close();
    }
  5. Run it in Sail:
    ./vendor/bin/sail node resources/js/capture.mjs

Do not assume the browser cache belongs to the same user that runs your Laravel worker. Puppeteer v19 and later normally cache browsers below $HOME/.cache/puppeteer. Installing as one user and launching as another can produce “Could not find Chrome” or “Could not find expected browser locally” even though installation appeared successful.

Make the cache predictable

Choose a shared, writable cache location and use it consistently during image build and runtime. Puppeteer supports configuration files and the PUPPETEER_CACHE_DIR environment variable (Puppeteer configuration). For example, in the Dockerfile or service environment:

ENV PUPPETEER_CACHE_DIR=/opt/puppeteer-cache

Create the directory, install the browser as the same user that will launch it, and grant that user read/execute access. If the cache is mounted as a volume, preserve ownership across container restarts.

Install system Chromium in the Sail image

Choose this route only when you specifically need the distribution package. The exact package name, executable path and dependency names vary by Sail base image and architecture. Add the browser and libraries to the Dockerfile used by laravel.test, rather than installing them interactively in a running container.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Logitech MK270 Full Size Wireless Keyboard and Mouse Combo - Black
  • Reliable Plug and Play: The USB receiver provides a reliable wireless connection up to 33 ft (1), so you can forget about drop-outs and delays and you can take it wherever you use your computer
  • Type in Comfort: The design of this keyboard creates a comfortable typing experience thanks to the low-profile, quiet keys and standard layout with full-size F-keys, number pad, and arrow keys
  • Durable and Resilient: This full-size wireless keyboard features a spill-resistant design (2), durable keys and sturdy tilt legs with adjustable height
  • Long Battery Life: MK270 combo features a 36-month keyboard and 12-month mouse battery life (3), along with on/off switches allowing you to go months without the hassle of changing batteries
  • Easy to Use: This wireless keyboard and mouse combo features 8 multimedia hotkeys for instant access to the Internet, email, play/pause, and volume so you can easily check out your favorite sites
  1. Identify the base distribution and release in the Dockerfile.
  2. Add the appropriate Chromium package using that distribution’s package manager. Do not copy an Ubuntu package command into a Debian image (or vice versa) without checking availability.
  3. Install the runtime libraries required by that image’s Chromium build.
  4. Build the image and locate the binary from inside the rebuilt container, for example with command -v chromium, command -v chromium-browser or the package manager’s file list.
  5. Pass the discovered path explicitly:
import puppeteer from 'puppeteer-core';

const browser = await puppeteer.launch({
  executablePath: '/actual/path/from-command-v',
  headless: true,
});

try {
  const page = await browser.newPage();
  await page.goto('https://example.com', { waitUntil: 'networkidle2' });
  await page.screenshot({ path: '/tmp/example.png' });
} finally {
  await browser.close();
}

puppeteer-core does not download a browser, so an executable path or externally managed connection is mandatory. You can also use the full puppeteer package with an explicit executablePath, but then you must still decide whether its bundled browser download is wanted.

Rebuild after every Dockerfile change

./vendor/bin/sail build --no-cache
./vendor/bin/sail up -d

An apt install performed inside an ephemeral running container disappears when that container is recreated. A Dockerfile change plus a rebuild makes the browser and libraries part of the Sail image.

Linux libraries, profiles and process handling

A successful npm install does not prove Chrome can start. Headless Chrome commonly needs shared libraries that are absent from minimal images. Puppeteer’s troubleshooting guide provides a Debian/Ubuntu dependency list, but it advises matching requirements to the actual Chromium/Chrome package, release and architecture (Puppeteer troubleshooting). When launch output reports a missing .so file, inspect the browser’s dependencies with ldd and add the package that supplies that library to the Dockerfile.

Read-only containers cause a different failure: Chrome must write configuration, cache and profile data. Set writable XDG locations and a user-data directory, or mount writable directories with correct ownership. A typical diagnostic launch looks like:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
  • All-day Comfort: The design of this standard keyboard creates a comfortable typing experience thanks to the deep-profile keys and full-size standard layout with F-keys and number pad
  • Easy to Set-up and Use: Set-up couldn't be easier, you simply plug in this corded keyboard via USB on your desktop or laptop and start using right away without any software installation
  • Compatibility: This full-size keyboard is compatible with Windows 7, 8, 10 or later, plus it's a reliable and durable partner for your desk at home, or at work
  • Spill-proof: This durable keyboard features a spill-resistant design (1), anti-fade keys and sturdy tilt legs with adjustable height, meaning this keyboard is built to last
  • Plastic parts in K120 include 51% certified post-consumer recycled plastic*
const browser = await puppeteer.launch({
  headless: true,
  userDataDir: '/tmp/puppeteer-profile',
});

Use /tmp only when its lifecycle and isolation suit your workload; a persistent profile can leak cookies between jobs.

Puppeteer’s Docker guidance recommends Docker’s --init option or another init process so child browser processes are reaped correctly (Puppeteer Docker guide). The project’s example Dockerfile demonstrates a non-root user and browser requirements, but it is not a drop-in replacement for a PHP-based Sail image (Puppeteer Dockerfile). Do not add --no-sandbox as a blanket fix. First correct the user, libraries, writable paths and process setup; change sandbox settings only after evaluating the security of the actual container.

Verify the installation before integrating Laravel

  1. Check versions in the same container and user context as the worker:
    ./vendor/bin/sail node --version
    ./vendor/bin/sail npm --version
    ./vendor/bin/sail npm list puppeteer puppeteer-core
  2. Run a minimal navigation and screenshot script. Use a URL reachable from the container and write to a known writable path.
  3. Confirm the output file exists and has non-zero size.
  4. If your Laravel queue runs under a different user, execute the same script as that user or inspect its HOME, cache and temporary directories.

Troubleshooting common failures

“Could not find Chrome” or “Could not find expected browser locally”

  • Confirm the dependency is puppeteer, not puppeteer-core, unless you intentionally provide a browser.
  • Check whether install scripts were disabled; run npx puppeteer browsers install.
  • Compare the user and HOME used during npm install with the user launching Chrome. Set a shared PUPPETEER_CACHE_DIR and fix ownership.
  • For system Chromium, verify executablePath against command -v inside the rebuilt image.

Browser starts, then exits with a missing-library error

Read the complete Chrome stderr output, run ldd on the actual executable, and add matching packages for the Sail base distribution. Rebuild the image; installing a library interactively is not persistent.

“Failed to launch” in a read-only container

Provide writable XDG cache/configuration and user-data paths, or mount writable directories owned by the runtime user. Avoid reusing one profile concurrently across jobs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Redragon K521 Upgrade Rainbow LED Gaming Keyboard, 104 Keys Wired Mechanical Feeling Keyboard with Multimedia Keys, One-Touch Backlit, Anti-Ghosting, Compatible with PC, Mac, PS4/5, Xbox
  • 【Dreamy Rainbow Gaming Keyboard】K521 Gaming Keyboard Adopts a Different LED Backlight Design, Upgraded on the Traditional LED Backlight Effect, Making the Light More Penetrating, Giving You a More Dazzling Visual Effect, Making Your Gaming Process More Enjoyable
  • 【One Touch Opens & Visual Feast】The K521 Red Dragon Keyboard has a One-Touch on/off Lighting Button for Added Convenience. It also has a Three-Position Adjustable Breathing Mode and a Four-Position Adjustable Brightness Lighting Mode
  • 【Mechanical Feeling & Fast Tapping】The PC Keyboard Keys are Designed for Mechanical Feeling, Giving You a Better Feel During Use and the Ability to Trigger Keys Quickly, Allowing You to Win All Your Games
  • 【19 Keys Anti-Ghosting Keyboard】Anti-Ghosting Ensures Every Button Can Be Triggered. This Allows You to Trigger Key Combinations In The Game Accurately, And Each Skill Can Be Accurately Released to Increase Your Winning Rate. Redragon K521 Will Be Your Perfect Partner
  • 【12 Multimedia Combination Keys】The K521 Wired Gaming Keyboard is Equipped with 12 Multimedia Keys That Can Greatly Enhance Your Gaming/Office Efficiency and Make It More Convenient to Use

Chrome hangs, leaves zombies or consumes resources

Use an init process as described in the Docker guide, close every browser in a finally block, and limit concurrent launches. Keep the full launch error when diagnosing rather than masking it with sandbox flags.

It works on the host but not in Sail

The host browser and libraries are irrelevant to the container. Run Node, npm, the browser lookup and the capture script through Sail, then inspect the container’s base image, architecture and environment.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Do not confuse Puppeteer with Laravel Dusk

Laravel’s Sail documentation describes an optional Selenium service for Laravel Dusk. Dusk is a separate browser-testing approach; Puppeteer does not require Selenium. Decide whether your code is a Node Puppeteer script or a Dusk test suite before adding services. Running both can be valid, but they have separate browser drivers, images and configuration.

Or skip the browser setup

If your goal is reliable screenshots rather than maintaining Chrome inside Sail, ScreenshotNeo provides a website screenshot API and MCP server. It accepts a URL and returns PNG, JPEG, WebP or PDF. Before capture it can accept cookie banners and remove more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. AI agents can use its MCP tools take_screenshot, get_page_info and capture_pdf.

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

One request is enough:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the complete option reference in the ScreenshotNeo documentation. It supports full-page and CSS-selector captures, dark mode, device presets and custom viewports, retina scale, PDF paper and page settings, custom CSS/JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. Existing parameter names used by other screenshot APIs are accepted to ease migration.

Best Value
Sale
Logitech K270 Full Size Wireless Keyboard for Windows - Black
  • All-day Comfort: This USB keyboard creates a comfortable and familiar typing experience thanks to the deep-profile keys and standard full-size layout with all F-keys, number pad and arrow keys
  • Built to Last: The spill-proof (2) design and durable print characters keep you on track for years to come despite any on-the-job mishaps; it’s a reliable partner for your desk at home, or at work
  • Long-lasting Battery Life: A 24-month battery life (4) means you can go for 2 years without the hassle of changing batteries of your wireless full-size keyboard
  • Simply plug the USB receiver into a USB port on your desktop, laptop or netbook computer and start using the keyboard right away without any software installation
  • Simply Wireless: Forget about drop-outs and delays thanks to a strong, reliable wireless connection with up to 33 ft range (5); K270 is compatible with Windows 7, 8, 10 or later

Free accounts include 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.

Other clients: Python and Node.js

The same API can be called without changing your Sail browser image:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Frequently Asked Questions

Should I install Chromium or let Puppeteer download Chrome?

Letting the puppeteer package download its compatible Chrome for Testing build is the least-maintenance local option. Choose system Chromium only when you need distribution-managed browser updates or an existing package policy.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Can Puppeteer run in Sail without Selenium?

Yes. Puppeteer launches its own browser process from Node. Selenium is an optional service documented for Laravel Dusk, which is a separate testing stack.

Why does a rebuild matter after editing the Dockerfile?

The running container is disposable. Rebuilding incorporates browser packages and shared libraries into the image so they remain available after recreation.

Quick Recap

Bestseller No. 1
SaleBestseller No. 3
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Plastic parts in K120 include 51% certified post-consumer recycled plastic*; Product carbon footprint: 4.02 kg CO2e
$12.34
SaleBestseller No. 5
Logitech K270 Full Size Wireless Keyboard for Windows - Black
Logitech K270 Full Size Wireless Keyboard for Windows - Black
Plastic parts in K270 include 38% certified post-consumer recycled plastic; Eight hot keys: For instant access to the Internet, e-mail, music volume and more
$21.48

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.