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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

If your terminal says playwright: command not found, first identify which Playwright command you meant to run. Playwright Test’s project CLI and the separate coding-agent CLI are installed and invoked differently. Install or run the correct package for your workflow; browser installation is a later step and will not fix a shell that cannot find the command.

First identify which Playwright command you need

“Playwright” can mean two different command-line workflows. Check the command you typed and what you were trying to do before changing your PATH or installing browser binaries.

Workflow Package Typical command
Run end-to-end tests for a web app @playwright/test in the project npx playwright test
Let a coding agent automate a browser @playwright/cli playwright-cli when installed globally, or npx playwright cli for local use

These commands are not interchangeable. If you meant the coding-agent tool but typed playwright, or meant Playwright Test but tried playwright-cli, install the package and use the command for the intended workflow.

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

Fix the Playwright Test command in a JavaScript project

Playwright Test is normally installed in the repository that uses it. Run the package manager’s local command runner from the project directory rather than assuming a global playwright command is available.

Install and verify with npm

  1. Open a terminal in the project directory—the folder containing its package.json.
  2. Install the test package as a development dependency:
    npm install -D @playwright/test
  3. Check that the local CLI runs:
    npx playwright --version
  4. Run the tests:
    npx playwright test

The Playwright introduction documents this project setup and the local CLI invocation: Playwright installation and introduction.

Use the runner that matches your package manager

If the project uses a different package manager, use its documented equivalent instead of mixing runners:

  • Yarn: yarn add --dev @playwright/test, then yarn playwright --version or yarn playwright test.
  • pnpm: pnpm add --save-dev @playwright/test, then pnpm exec playwright --version or pnpm exec playwright test.

Use the package manager the repository already uses. If you are unsure, check for its lockfile—such as package-lock.json, yarn.lock, or pnpm-lock.yaml—and follow the project’s existing setup.

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

Fix the coding-agent CLI command

The coding-agent CLI is a separate package, @playwright/cli. Its executable is playwright-cli. The official installation guide says this CLI requires Node.js 20 or newer; that requirement is specific to the coding-agent CLI and should not be assumed to apply to every Playwright language binding.

Install it globally

If you want to invoke playwright-cli from any directory, install the package globally as documented:

npm install -g @playwright/cli@latest

Then try the command you need, for example:

playwright-cli --help

A global install is optional, not a general fix for Playwright Test. The package manager’s global executable directory must be available to your shell for this form to work.

Install it locally

For a repository-specific setup, add the package as a local development dependency and use the local invocation shown in the official guide:

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.

npm install -D @playwright/cli

npx playwright cli --help

The local form is useful when the tool belongs to one project and you do not want to rely on a global executable. See the Playwright coding-agent CLI guide and its installation page for the documented options.

Install browsers only after the command works

A shell error saying the command itself cannot be found occurs before Playwright can launch a browser. First make sure the correct package is installed and that its CLI runs. If the CLI then reports missing browser binaries, install the browsers associated with that Playwright package:

npx playwright install

Playwright’s browser guide explains that “Each version of Playwright needs specific versions of browser binaries to operate.” After updating Playwright, you may need to run the browser installation command again so the matching binaries are present.

On supported Linux or CI setups, a later error about missing operating-system libraries is a separate dependency issue. The documented options include:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • npx playwright install-deps to install browser system dependencies.
  • npx playwright install --with-deps to install browsers and those dependencies together.

Neither command repairs a missing shell executable. Consult the browser installation guide for the browser and system-dependency steps.

Diagnose the exact failure before changing PATH

There is no universal PATH edit for every “Playwright command not found” case. The right diagnosis depends on the operating system, shell, project language, package manager, exact command, and full error text. Check these points first:

  • What did you type? Distinguish playwright, playwright-cli, and a language-specific command.
  • Which workflow did you intend? Playwright Test uses a project dependency; the coding-agent workflow uses @playwright/cli.
  • Are you in the project directory? Local package runners need to run where the dependency is installed.
  • Is the expected dependency declared and installed? Check the project’s package.json and run its package-manager install if needed.
  • What is the next error? “Command not found” differs from “browser executable missing” or a message about operating-system libraries. Fix the layer that the error actually identifies.

If the intended executable is globally installed but still unavailable, the package manager’s global executable directory or shell configuration may be involved. The appropriate check varies by platform and shell; gather those details before applying a PATH change rather than copying a generic edit.

Common causes and fixes

What you see Likely cause What to do
playwright: command not found in a test project The project dependency is absent, or the global command is being assumed. Install @playwright/test in the project and run it with npx playwright, Yarn, or pnpm exec.
playwright-cli: command not found @playwright/cli is not installed globally, or its global executable cannot be found. Install the coding-agent CLI globally, or add it locally and use npx playwright cli.
npx playwright cannot run as expected The dependency may not be installed in this repository, or the command is being run from the wrong directory. Move to the project directory, check package.json, install dependencies, and retry.
The CLI runs but reports a missing browser executable The browser binaries for the installed Playwright version are missing. Run npx playwright install.
A Linux or CI launch reports missing shared libraries or system dependencies Required operating-system dependencies are missing. For supported setups, use npx playwright install-deps or npx playwright install --with-deps.

Performance, reliability, and setup choices

For a project test suite, a local dependency keeps the command tied to the repository’s declared package setup; it also avoids relying on an unspecified global Playwright version. Use the matching package-manager runner and keep the dependency and lockfile in sync through the project’s normal installation process.

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.

A global coding-agent CLI is convenient when you intend to call playwright-cli across projects, but it depends on your global package configuration and shell’s executable lookup. A local install makes the dependency explicit for a particular project and uses npx playwright cli instead. Choose based on whether the command is meant to be shared by a project or available across your shell.

Browser binaries are a separate download from the command-line package. Installing them only after confirming the CLI works makes troubleshooting clearer: command resolution, browser availability, and operating-system dependencies are different failure stages. Updating Playwright may require reinstalling the corresponding browsers.

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

When the error persists

For a targeted diagnosis, collect the details that distinguish an installation problem from shell lookup or browser setup:

  • Operating system and shell, including whether the command runs in a terminal, IDE, container, or CI job.
  • Project language and package manager.
  • The exact command entered and the complete error output.
  • Whether you intended Playwright Test or coding-agent browser automation.
  • Whether the failure occurs at command lookup, browser launch, or while loading the page.

With these details, the fix can be matched to the correct package and environment. Without them, a platform-specific PATH command risks changing the wrong configuration.

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

Or skip the browser setup

If your goal is simply to capture a website rather than run browser automation or tests, ScreenshotNeo provides a screenshot API. Make one GET request with the target URL to receive a PNG, JPEG, WebP, or PDF. For example, using cURL:

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 the request options. ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and whether the shot was billed. It also offers an MCP server with tools for AI agents, including Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots per month with no card required; paid plans start at $5 for 3,000 shots. Sign up free for ScreenshotNeo.

Frequently Asked Questions

Does “command not found” mean Playwright is installed but browsers are missing?

No. It indicates the shell could not find the command; missing browsers are reported later, when the available CLI tries to launch one.

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

Can I use `playwright-cli` to run Playwright Test?

No. `playwright-cli` belongs to the separate coding-agent package. Playwright Test uses the `playwright` project CLI through a package-manager runner.

What details should I include when asking for help?

Include your operating system and shell, project language and package manager, intended workflow, exact command, and complete error text.

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.