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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

If Puppeteer throws ENOENT while saving a screenshot, check the destination path’s parent folders. A relative path is resolved from Node.js’s current working directory, and Puppeteer’s screenshot documentation does not say it creates missing directories. Create the parent folder before calling page.screenshot(), then log the resolved destination to confirm where the file will go. Puppeteer’s ScreenshotOptions documentation describes the path behavior; Node.js filesystem documentation explains ENOENT for paths that do not exist.

Why Puppeteer screenshot paths produce ENOENT

Puppeteer’s screenshot path names the file to save, and its format is inferred from the filename extension. When that path is relative, Puppeteer resolves it against process.cwd()—the process’s current working directory, not automatically the directory containing your JavaScript file. If any parent directory in the destination is missing, the filesystem operation can fail with ENOENT.

For example, screenshots/run/page.png requires both screenshots and screenshots/run to exist beneath the process working directory. Puppeteer’s screenshot guide shows saving a page or element screenshot with page.screenshot(), but does not document automatic creation of missing parent folders. If you omit path, Puppeteer does not save the screenshot to disk.

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

The cited API documentation surfaced as Puppeteer version 25.12.0, and the filesystem documentation as Node.js v26.10.0; those are documentation versions, not a statement about the versions installed in your project.

#1 Best Overall
Sandisk 2TB Extreme Portable SSD, Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware, External Solid State Drive, SDSSDE61-2T00-G25
  • Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
  • Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
  • Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
  • Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
  • Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C

Fix the output directory before capturing

  1. Check the process working directory. Print process.cwd() so you know the base used for relative screenshot paths.
  2. Resolve and inspect the destination. Log the full path and check its spelling, capitalization, separators, and intended project or deployment location.
  3. Create the parent directory. Use Node.js’s promise-based mkdir() with { recursive: true } before saving.
  4. Capture to the resolved path. Pass the absolute path to page.screenshot().
  5. If ENOENT persists, inspect the error. Check the full error.path and runtime environment to see which absolute location the failing operation attempted to use.

Runnable example

This ES module pattern creates screenshots under the process working directory, then saves the page image there. It assumes page is an already-created Puppeteer page.

import { mkdir } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';

const outputPath = resolve(process.cwd(), 'screenshots', 'page.png');
console.log('Working directory:', process.cwd());
console.log('Screenshot destination:', outputPath);

await mkdir(dirname(outputPath), { recursive: true });
await page.screenshot({ path: outputPath });

Choose a predictable path strategy

Approach How it works Trade-off
Fixed absolute path Set a full destination path for a controlled deployment and create its parent folder. The location is explicit and predictable there, but may need configuration for another machine, container, or deployment.
Relative path from a known working directory Resolve a relative filename against an intentionally chosen base, such as process.cwd(), and create the parent folder. It can be portable when the base is controlled, but test runners and deployment environments may start the process from a different working directory than expected.

Neither strategy is prescribed for every application. The important point is to make the base directory deliberate and ensure the parent exists before the screenshot write.

Rank #2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
  • Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
  • Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
  • Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
  • Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
  • From Sandisk, a brand professional photographers trust to take on assignments.

Troubleshoot ENOENT if creating the directory did not fix it

  • The logged path is not where you expected: compare it with process.cwd(). A script’s file location and the process working directory are not necessarily the same.
  • A nested folder is missing: ensure mkdir(dirname(outputPath), { recursive: true }) runs before the screenshot call, and that outputPath is the same path passed to Puppeteer.
  • The path contains a typo or case mismatch: inspect each directory and filename segment, including capitalization and path separators.
  • The error names a different path: use error.path to identify the location reported by Node.js, then investigate that location and the runtime environment.
  • You omitted the screenshot path: without path, Puppeteer does not write an image file to disk. Provide a filename if disk output is what you want.
  • You suspect a browser launch problem: this symptom points to a path or filesystem issue to investigate. The cited documentation does not support changing browser-installation settings or disabling browser security options as a fix for ENOENT.

Or skip the browser setup

If your goal is simply to get a website screenshot, ScreenshotNeo provides a screenshot API. Make one GET request with the target URL; see the ScreenshotNeo API documentation for request options.

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://stripe.com -o shot.webp

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the Free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000. Sign up for free.

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

Frequently Asked Questions

Does Puppeteer create a missing screenshot directory automatically?

Its screenshot documentation does not state that missing parent directories are created. Create them before saving.

Rank #3
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Is a relative screenshot path based on the JavaScript file’s directory?

No. Puppeteer resolves a relative screenshot path from the process current working directory.

Quick Recap

Bestseller No. 2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
From Sandisk, a brand professional photographers trust to take on assignments.
$188.90
SaleBestseller No. 3
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
SaleBestseller No. 4
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.; POCKET-SIZED – fits easily in pockets and small bags.
$249.99
Bestseller No. 5
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$229.99
Best Value
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
Rank #4
Sale
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
  • NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
  • IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
  • POCKET-SIZED – fits easily in pockets and small bags.
  • SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
  • 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.

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.

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