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

Set PLAYWRIGHT_BROWSERS_PATH before both playwright install and the process that launches Playwright, using the same directory each time. For example: export PLAYWRIGHT_BROWSERS_PATH="$HOME/pw-browsers", then run npx playwright install and your tests or script. A one-command prefix works for a single process; an exported variable applies to later commands in the shell.

What PLAYWRIGHT_BROWSERS_PATH controls

Playwright downloads browser revisions that match the Playwright release. The environment variable changes where those managed binaries are installed and where Playwright looks for them at runtime. The installation process and the test or script process must see the same value; setting it for only one of them commonly produces a “browser executable doesn’t exist” or “executable not found” error.

The variable does not relocate Google Chrome or Microsoft Edge installed by the operating system. Those branded browsers continue to use their system-wide installation locations. See the Playwright browser documentation for the supported environment-variable behavior.

Choose a browser directory

Choice How to select it Best fit Important lifecycle detail
Default OS cache Leave PLAYWRIGHT_BROWSERS_PATH unset Personal development when the default location is convenient Playwright chooses an OS-specific cache directory
Custom shared directory Set the variable to a user-owned path such as $HOME/pw-browsers Several projects or processes sharing one browser download Every process must use the identical path and have read/write access
Hermetic, project-local install Set PLAYWRIGHT_BROWSERS_PATH=0 Packaging browsers with a project or isolating them from a user’s cache In the documented Node.js layout, binaries are placed under node_modules/playwright-core/.local-browsers

Default locations by operating system

Operating system Default managed-browser cache
Windows %USERPROFILE%AppDataLocalms-playwright
macOS ~/Library/Caches/ms-playwright
Linux ~/.cache/ms-playwright

These defaults and hermetic mode are documented at playwright.dev/docs/browsers.

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

Set it in each shell

Bash, Zsh, and other POSIX shells

Prefix both commands when you want the setting to apply only to those commands:

PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright test

For a whole terminal session, export it once:

export PLAYWRIGHT_BROWSERS_PATH="$HOME/pw-browsers"
npx playwright install
npx playwright test

Create the directory first if your account or CI runner does not automatically create it:

mkdir -p "$HOME/pw-browsers"
export PLAYWRIGHT_BROWSERS_PATH="$HOME/pw-browsers"
npx playwright install

PowerShell

$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILEpw-browsers"
npx playwright install
npx playwright test

Use a fully qualified path when the job runs under a service account, because $Env:USERPROFILE can differ between interactive and CI users.

Windows Command Prompt

set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%pw-browsers
npx playwright install
npx playwright test

set affects the current Command Prompt window. Open windows and separately launched services do not inherit a value that was set elsewhere.

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

Use the same setting with other language bindings

The variable is read from the process environment, so the shell syntax is the only part that changes between Playwright languages. The official language-specific browser pages cover Node.js, Python, Java, and .NET (Python, Java, and .NET).

Python

export PLAYWRIGHT_BROWSERS_PATH="$HOME/pw-browsers"
python -m playwright install
python your_script.py

On Windows PowerShell, set $Env:PLAYWRIGHT_BROWSERS_PATH first, then run python -m playwright install and your Python test command in that same session.

Node.js with a one-command scope

PLAYWRIGHT_BROWSERS_PATH="$HOME/pw-browsers" npx playwright install
PLAYWRIGHT_BROWSERS_PATH="$HOME/pw-browsers" node screenshot.js

For Java or .NET, set the variable in the shell or CI environment before invoking the binding’s documented browser-install command and before starting the test runner. Do not install into one path and launch from another.

Hermetic installs for reproducible projects

Set the value to 0 when the browser binaries should live with the local Playwright package rather than in a user cache:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
PLAYWRIGHT_BROWSERS_PATH=0 npx playwright install
PLAYWRIGHT_BROWSERS_PATH=0 npx playwright test

In the documented Node.js example, this creates node_modules/playwright-core/.local-browsers. Keep the same package installation and variable value in the environment that runs the tests. Hermetic mode increases project-local disk usage and is different from moving browsers to a shared cache.

Sharing one directory safely

A shared directory can avoid duplicate downloads for multiple projects or workers. Choose a stable, user-owned location and make sure every process can read it and the installer can write it. Avoid pointing unrelated users at a directory with permissions that expose private files. If two jobs install simultaneously, serialize the installation step or let one job prepare the directory before workers start.

Changing the path does not convert one browser revision into another. Playwright releases are tied to particular browser revisions, so a project update can require another playwright install even when the directory already contains older browsers.

Version updates and browser cleanup

After upgrading Playwright, run the install command again with the same PLAYWRIGHT_BROWSERS_PATH. Playwright tracks which clients need browser packages and may remove revisions it considers no longer required. If you must retain an otherwise unused browser, set PLAYWRIGHT_SKIP_BROWSER_GC=1 or install with the documented --no-remove option. Details and command-line options are in the Playwright command-line documentation.

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

Do not assume that a directory containing an older revision is valid for a newer Playwright package. Treat the Playwright package version and browser directory contents as one cache key.

CI and cache decisions

Playwright’s CI guidance notes that caching is not automatically faster: restoring a cache can take about as long as downloading the browsers. If your team caches them, key the cache by the Playwright version so a cache created for a different browser revision is not reused. The recommendation is described in Playwright’s continuous-integration guide.

A practical CI sequence

  1. Choose a deterministic path inside the job workspace or the CI tool’s cache directory.
  2. Set PLAYWRIGHT_BROWSERS_PATH in the job environment before any install step.
  3. Include the exact Playwright version in the cache key, or skip caching when downloading is faster.
  4. Run the documented browser installation command on a cache miss.
  5. Launch tests with the same environment variable and path.

When a job runs as a different operating-system user than the cache-restore step, check ownership and permissions before blaming Playwright for a missing executable.

Troubleshooting

“Executable doesn’t exist” after a successful install

The install and runtime processes probably used different values, or the runtime process did not inherit the variable. Export the variable in the parent shell (or CI job) and rerun both installation and tests. Also verify that the path is readable by the account running the test.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Browsers keep downloading on every run

Check for spelling, quoting, and shell scope. A command prefix applies to one command only; an exported variable must be present in the shell that launches the test. In CI, ensure the cache-restore and test steps use the same job-level environment.

A path works locally but fails in CI

Do not rely on ~ or a developer-specific home directory when the runner uses another account. Use an absolute, job-appropriate path, create it, and confirm the runner can write during installation and read during execution.

Old revisions disappear

This is Playwright’s browser garbage collection. Retain an otherwise unused revision with PLAYWRIGHT_SKIP_BROWSER_GC=1 or the install command’s --no-remove option, then manage disk usage deliberately.

Chrome or Edge is still in the system location

That is expected. PLAYWRIGHT_BROWSERS_PATH applies to Playwright-managed browser binaries, not branded Chrome or Microsoft Edge installations.

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

Cache restores but the browser revision is incompatible

Invalidate the cache and reinstall using the current Playwright version. Cache keys that omit the Playwright version can restore a directory containing the wrong browser revision.

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 simply to obtain a reliable website image rather than run a local Playwright browser, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers.

One GET request returns PNG, JPEG, WebP, or a PDF:

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 ScreenshotNeo API documentation for parameters and response details. Equivalent Python and Node.js calls are:

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}`);

ScreenshotNeo also offers an MCP server for Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools. Its options include full-page and element capture, device and viewport settings, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user-agent, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification.

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.

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is available on every plan, and yearly billing gives two months free. Sign up for the free plan.

Frequently Asked Questions

Does setting the variable change where Playwright stores its npm or Python package?

No. It selects the directory for Playwright-managed browser binaries; the language package remains wherever your package manager installed it.

Can I use a relative path?

Use an absolute path for predictable behavior, especially in CI, services, and shells launched from different working directories.

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.