Spatie Browsershot errors on Windows with XAMPP are usually caused by one broken link in a chain: PHP launches Node, Node loads Puppeteer, and Puppeteer launches Chrome. Fix the link named by the exception instead of reinstalling every component. Browsershot v4 currently requires Node 22.0 (LTS) or newer and Puppeteer 23.0 or newer, but those requirements do not guarantee that the Apache process used by XAMPP can find the same executables, modules, browser files, or permissions as your terminal.
This guide starts with the exact error, separates official configuration guidance from anecdotal Windows reports, and ends with a reproducible XAMPP test.
How the Browsershot chain works
Browsershot is a PHP package that delegates rendering to the Puppeteer Node library, which controls headless Google Chrome. It can render a URL, HTML string, or local HTML file as an image or PDF. Composer installing PHP code proves only that the PHP package exists; it does not prove that the request-handling process can invoke Node, resolve Puppeteer, or launch a usable Chrome binary. See Spatie’s introduction.
- PHP/Laravel: your application calls Browsershot.
- Node.js: Browsershot’s script is executed by Node.
- Puppeteer: Node resolves the package and its dependencies.
- Chrome/Chromium: Puppeteer launches a browser process.
- Windows/XAMPP process context: Apache’s account, PATH, permissions, and working directory may differ from an interactive shell.
Record the complete exception before changing anything: command, exit code, standard error, working directory, and whether it fails in CLI PHP, an XAMPP Apache request, or both. That information identifies the failing link.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
Check versions before changing paths
The current Browsershot v4 requirements state: “This package requires Node 22.0 (LTS) or higher and the Puppeteer Node library (v23.0 or higher).” Treat this as a v4 requirement, not a rule for every older Browsershot release.
- Check the installed Browsershot major version in
composer.lockor with Composer. - Check the Node version used by the failing process, not only the version shown by your terminal.
- Check the Puppeteer version in the
package.jsonand lock file that the Browsershot script actually uses. - Compare those values with the version-specific Spatie documentation before upgrading or downgrading.
Browsershot is installed with Composer, while Puppeteer is a separate Node dependency. Puppeteer’s installation guide says installation normally downloads a compatible Chrome for Testing build and a chrome-headless-shell binary. Package managers configured to block install scripts can skip that download.
Fix “Cannot find module ‘puppeteer’”
This literal error is a JavaScript module-resolution failure. It does not, by itself, mean Node is missing or Chrome is missing.
Verify the module location
Find the node_modules directory containing Puppeteer and determine whether it is relative to the script Browsershot runs. A global installation is not automatically visible to a project script. In a Windows 11 report opened April 18, 2024, a user had installed Puppeteer globally while Browsershot’s browser.cjs still reported this error; that is an anecdotal issue report, not proof that every global installation fails or a confirmed XAMPP fix. See discussion #840.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRank #2
- 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
- 4GB DDR4 System Memory; 128GB Solid State Drive
- 11.6" HD (1366 x 768) Multi-Touch Display
- Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
- Windows 11 Pro
Set Browsershot’s module directory explicitly
Spatie documents setNodeModulePath for an alternate module directory. Point it to the project directory that contains the intended node_modules, then retest through the same request path. Do not point it at a directory that contains only a globally installed package unless that directory is deliberately configured and readable by Apache.
$shot = Browsershot::url('https://example.com')
->setNodeModulePath('C:pathtoyourprojectnode_modules');
The exact PHP method signature and other setup methods are maintained in Spatie’s installation and setup documentation. Use the path syntax accepted by your installed version.
Fix Node or npm not found by PHP
Spatie notes that Node and npm may not be directly available to Browsershot. It provides separate controls for the Node executable, npm executable, and include path: setNodeBinary, setNpmBinary, and setIncludePath.
Configure the executable paths
$shot = Browsershot::url('https://example.com')
->setNodeBinary('C:Program Filesnodejsnode.exe')
->setNpmBinary('C:Program Filesnodejsnpm.cmd')
->setIncludePath(getenv('PATH'));
Use the real paths on the machine running Apache. If Node was installed through a version manager, its path may be under your user profile rather than Program Files. Keep the paths in configuration rather than hard-coding a guess.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #3
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
Test the same execution context
A command that succeeds in PowerShell is not conclusive evidence for an XAMPP request. Apache may run under a different Windows account, inherit a different PATH, or lack access to a user-profile directory. Create a temporary diagnostic endpoint or an application log entry that reports the effective PHP environment, then remove it after testing. Compare CLI PHP and the Apache request separately:
- Can the failing PHP process execute the configured Node binary?
- Does that process see the intended working directory and module path?
- Can its Windows account read and execute Node, the project files, and Puppeteer’s browser cache?
Fix a missing or incorrect Chrome path
If the exception says Chrome or a browser cannot be found, first determine whether Puppeteer’s install script completed. If install scripts were blocked, the expected downloaded browser may not exist. Reinstalling the package without allowing its required install step will reproduce the same state.
Choose managed or separately installed Chrome
| Approach | Who provisions it | What to verify |
|---|---|---|
| Puppeteer-managed Chrome for Testing | Puppeteer’s installation process | The install script ran, the browser cache exists, and Apache’s account can read and execute it. |
| Separately managed Chrome or Chromium | You or an administrator | The executable exists on the same machine and Browsershot is configured with its exact path. |
Spatie exposes setChromePath. Configure it only when you have identified the actual executable:
$shot = Browsershot::url('https://example.com')
->setChromePath('C:Program FilesGoogleChromeApplicationchrome.exe');
A user-installed browser under another profile may be invisible to the Apache account. Prefer a machine-readable location or grant narrowly scoped access according to your organization’s policy.
Rank #4
- EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
- 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
- RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
- ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
- LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.
Fix Windows sandbox permission errors
Puppeteer’s troubleshooting guide covers permission failures involving downloaded Chrome files. Starting with Puppeteer v22.14.0, Puppeteer attempts to configure required permissions with Chrome’s setup tool during installation.
When the error continues
- Identify the browser cache directory actually used by the failing Node process and the Windows account running Apache.
- Check that account’s read and execute permissions on the browser directory and its parent directories.
- Follow Puppeteer’s version-aware guidance; for older versions, its documentation includes an
icaclsexample. - Grant only the access required by that account. Do not paste a cache path from an unrelated user’s profile.
Changing Windows permissions globally, disabling security features, or adding arbitrary sandbox flags can conceal the real problem and weaken the machine. Use the documented permission procedure for the installed Puppeteer version.
Retest through XAMPP Apache
After each targeted change, call the same Laravel route through the XAMPP Apache URL that originally failed. Test both a simple URL and your real input.
- Render a stable public URL such as
https://example.com. - Render a small HTML string to separate network failures from browser startup failures.
- Render the production URL or local file.
- Record the new exception, exit code, standard error, and elapsed time.
If CLI succeeds but Apache fails, prioritize PATH, account permissions, working directory, and user-profile browser caches. This process-context conclusion is a practical diagnostic inference from Windows reports, not an official universal XAMPP recipe.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsBest Value
- WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
- 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
- 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
- CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
- LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
Common symptoms and targeted fixes
| Symptom | Likely link | Targeted action |
|---|---|---|
Cannot find module 'puppeteer' |
Node module resolution | Install Puppeteer in the project used by the script or set setNodeModulePath explicitly. |
| Node or npm executable not found | PHP-to-Node lookup | Set setNodeBinary, setNpmBinary, or setIncludePath; verify from Apache. |
| Could not find Chrome/browser | Browser provisioning or path | Confirm install scripts downloaded a browser, or set setChromePath to an existing executable. |
| Sandbox or access-denied message | Windows file permissions | Identify the real cache and account; apply Puppeteer’s version-specific permission guidance. |
| Works in terminal, fails in Laravel | Process context | Compare Apache’s PATH, account, module path, working directory, and cache access with CLI. |
What Windows/XAMPP reports do—and do not—prove
Spatie discussion #840 documents the global-install/module-resolution scenario. Discussion #771, opened September 5, 2023, includes Windows and XAMPP-related comments but mixed reports and guesses rather than a controlled XAMPP reproduction or authoritative resolution: read the discussion. Therefore, no single XAMPP setting can honestly be presented as a universal fix. Ask anyone helping you to include the exact exception and whether it occurs in CLI PHP, Apache, or both.
Or skip the browser setup:
If you only need a reliable screenshot or PDF endpoint rather than Laravel-controlled Puppeteer, ScreenshotNeo makes one GET request to capture a URL. Cookie and consent banners are accepted and 60+ known consent platforms, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be disabled. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. It also provides an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
Use the ScreenshotNeo API documentation for options such as full-page capture, CSS selectors, device presets, retina scale, PDF margins and page ranges, custom CSS/JavaScript, waits, request blocking, headers, cookies, geolocation, caching, signed links, webhooks, bulk capture, and usage reporting.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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}`);
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan. Create a free ScreenshotNeo account.
Frequently Asked Questions
Should I install Puppeteer globally on Windows?
No. A global installation is not proof that Browsershot’s script can resolve the module. Use the project module directory or configure Browsershot’s module path explicitly.
Is XAMPP itself the cause of every Browsershot error?
No. XAMPP changes the process context, especially Apache’s account and environment, but the exception may identify Node lookup, module resolution, browser provisioning, or permissions instead.
Can I fix Chrome errors by adding a random –no-sandbox flag?
Do not use an arbitrary flag as a first remedy. Identify the browser path and Windows permissions, then follow Puppeteer’s version-specific troubleshooting guidance.
Quick Recap
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.

