What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Error -4048 is usually Node.js reporting a Windows EPERM filesystem failure, not a Playwright-specific error code. In the matching report, Node failed while running scandir against C:Users…AppDataLocalElevatedDiagnostics. That means the process could not read a directory; the number alone does not identify whether permissions, a security policy, another process, or configuration caused the denial.
Start with the complete error—including code, syscall, and path—before changing Playwright. Then follow the branch that matches the operation named in your own message.
What “Error -4048” actually means
The October 7, 2022 report that matches this question shows an error shaped like:
errno: -4048
code: 'EPERM'
syscall: 'scandir'
path: 'C:\Users\...\AppData\Local\ElevatedDiagnostics'
EPERM means Windows refused a filesystem operation. scandir is Node.js reading the entries in a directory. “4048” is the negative errno value accompanying that failure; it is not a documented Playwright diagnosis. Node’s filesystem documentation uses EPERM for Windows operation failures, but that example does not establish why this separate scandir was denied (Node.js file-system documentation).
#1 Best Overall
The path matters more than the number. The cited path is ElevatedDiagnostics, not Playwright’s normal browser-download cache. The available report does not identify the Windows account, policy, Node.js version, Playwright version, launch command, or project configuration, so no universal root cause can honestly be asserted.
First, capture the information that can identify the failing branch
- Copy the entire stack trace, not only “Error -4048.” Preserve
code,errno,syscall,path, and any nested error. - Record the exact command you ran, such as
npx playwright test, a Node script, or an npm setup command. - Record your Node.js and Playwright versions and whether the command runs in a terminal, an IDE task, CI, a service account, or another process.
- Check whether the named path is the directory you intended Playwright or your script to inspect. An unexpected path can indicate project configuration, an environment variable, a test fixture, or another dependency—not a browser problem.
- Try to reproduce with one minimal script in the same project and under the same Windows account. Do not assume that running a different terminal changes the process identity or permissions.
Choose the repair by the operation and path
| What the error names | What it tells you | Next action |
|---|---|---|
EPERM plus scandir and an unexpected or protected directory |
Node was denied while listing that directory; the cause is not established by the code alone. | Inspect the path, account, policies, and project code that requested the scan. Avoid treating browser installation as the fix. |
| A missing browser executable or an error saying a browser is not installed | The Playwright package is present but its corresponding browser binary is unavailable. | Install the browsers for the installed Playwright version with npx playwright install. |
A different filesystem operation, such as open, mkdir, or unlink |
The failure concerns that operation and path, not necessarily Playwright. | Investigate the named file or directory, locks, permissions, and the process identity shown by your environment. |
Branch A: troubleshoot an EPERM scandir failure
Verify the target directory
Look at the exact path in the exception. If it points into AppDataLocalElevatedDiagnostics or another directory your test never meant to scan, search your project and configuration for code that enumerates directories. Also check scripts, test fixtures, reporters, glob patterns, and environment variables that supply a root directory. The cited question does not show which component requested this scan, so changing Playwright settings without finding that request can hide the real issue.
Check the identity and access policy
Run the same command as the same Windows user that normally runs the tests. An IDE, scheduled task, CI runner, or service can use a different account. Confirm that the account can open and list the named directory in File Explorer and that organizational security software has not restricted it. If your organization manages the machine, ask an administrator to review the relevant policy rather than broadly disabling protection.
Remove avoidable contention safely
Close tools that may be actively creating or scanning files in the directory, then retry. Do not delete an unfamiliar diagnostics directory merely because it appears in the path. Make a backup and obtain approval before changing ownership, permissions, or security settings; an administrator elevation can change which account performs the operation without correcting the underlying policy.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsIsolate the project
Create a small project in a normal user-writable folder and run a minimal Playwright test. If that works while the original project fails, compare the original working directory, configuration, hooks, and environment variables. If both fail on the same directory, the issue is more likely Windows access or a machine policy than an individual test.
Branch B: install browsers only when the symptom is a missing executable
Playwright versions require corresponding browser binaries. The official browser guide documents this command:
npx playwright install
On Windows, the default browser cache is %USERPROFILE%AppDataLocalms-playwright (Playwright browser installation documentation). A missing executable message may therefore be fixed by installing the browsers with the same Node/npm environment that runs your tests. If installation itself fails, preserve that new error and troubleshoot its path and permissions separately.
This branch should not be conflated with the cited ElevatedDiagnostics scandir error: that path is different, and the available report does not show that browser installation resolves it.
Rank #3
A reported setup attempt—use it with the right expectations
One respondent on the matching Stack Overflow question said that running the following solved a similar problem:
npm init playwright@latest
This command creates or initializes a Playwright project through npm. It is an anecdotal report from one answer, not an official diagnosis, a guaranteed repair, or proof that it changes permissions on ElevatedDiagnostics. Use it when you are establishing a project and can safely review the files and prompts it creates. If your project already exists, first preserve its configuration and lockfile; do not replace a working setup solely because the number “4048” appears in an unrelated filesystem exception.
Reproduce with a minimal screenshot script
After resolving the filesystem issue or creating a clean test project, this minimal script checks whether Playwright can launch its installed browser:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.screenshot({ path: 'example.png', fullPage: true });
await browser.close();
})();
Run it with node screenshot.js from the project directory. A missing-browser message belongs to Branch B. An EPERM that names a directory belongs to Branch A; retain the new path and syscall when diagnosing it.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Common symptoms and precise responses
“The error says Playwright, so Playwright must be broken”
Not necessarily. Node reports the operation that failed, and a dependency or project hook can perform that operation. Read syscall and path before changing package versions.
“I installed browsers, but -4048 remains”
If the exception still says EPERM and scandir for ElevatedDiagnostics, browser installation addressed a different condition. Return to the directory, identity, and policy checks.
“Running as administrator fixed it temporarily”
That result shows that the execution context changed; it does not prove which permission or policy was responsible. Prefer correcting the project path or approved account permissions over routinely running tests elevated.
“The command works in a terminal but not in my IDE or CI”
Compare the working directory, environment variables, Node executable, npm configuration, and Windows account. The process that fails may be scanning a different path or using a different identity.
Best Value
“A clean project also fails”
Capture the complete stack trace from the clean project. If it names the same protected directory, involve the machine administrator or security team with the exact path and operation; the available evidence cannot identify a single policy that caused it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your goal is simply to obtain a reliable website screenshot, ScreenshotNeo returns a PNG, JPEG, WebP, or PDF from one GET request without requiring a local Playwright browser. Its cleanup steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks or 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 tools for Claude, Cursor, and other MCP clients.
For the full parameter list, see the ScreenshotNeo documentation. A cURL request is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan. Sign up for the free ScreenshotNeo plan.
Recommended Free Tools
Python and Node.js alternatives for the same API call
Python
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)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Operational notes before you retry
- Keep the failing path and syscall in bug reports; “4048” by itself is not actionable.
- Use the same Node.js executable, npm environment, account, and working directory when comparing runs.
- Do not claim success from a command that merely changes project initialization unless the original failing operation no longer occurs.
- For browser errors, keep Playwright and its browser binaries aligned by installing with the project’s own
npxcommand. - For protected directories, involve an administrator rather than weakening security controls blindly.
Frequently Asked Questions
Is error 4048 a Playwright error code?
In the matching report, it is the negative Windows errno accompanying Node.js EPERM; the useful diagnosis comes from the operation and path, such as scandir on ElevatedDiagnostics.
Should I delete the ElevatedDiagnostics folder?
No. The available report does not establish that deletion is safe or necessary. Identify the process requesting the scan and follow your organization’s access and retention rules.
When should I run npx playwright install?
Use it when the actual error says a required Playwright browser executable is missing. It is not established as a fix for an EPERM directory-scan failure.
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.

