How to uninstall Playwright

Get clear step-by-step guidance to completely remove Playwright along with its browsers, caches, and configuration files for a clean setup.

Get Started free
How to Uninstall Playwright
Home Guide How to Uninstall Playwright

How to Uninstall Playwright

Playwright is a powerful automation framework, but sometimes it becomes necessary to remove it, whether to free up space, fix configuration issues, or switch testing tools.

Overview

Uninstalling Playwright isn’t just about deleting a package; it also involves cleaning up browser binaries and caches.
Here’s how to uninstall Playwright quickly:

Node.js:

  • npm uninstall playwright or npm uninstall @playwright/test
  • Remove browsers: npx playwright uninstall –all

Python:

  • pip uninstall playwright
  • Remove browsers: playwright uninstall

.NET:

  • dotnet remove package Microsoft.Playwright
  • Remove browsers: pwsh bin/Debug/netX/playwright.ps1 uninstall –all

Optional:

Delete cache folders like ~/.cache/ms-playwright or %USERPROFILE%AppDataLocalms-playwright to reclaim space.

This article explores step-by-step methods to completely uninstall Playwright across different environments, along with cleanup tips, troubleshooting advice, and a smarter alternative for automated testing.

Understanding Playwright Uninstalling

Uninstalling Playwright isn’t just about removing a single package, it involves clearing both the Playwright framework and the browser binaries it installs locally. When you set up Playwright, it automatically downloads browser engines like Chromium, Firefox, and WebKit, which can take up several hundred megabytes of space.

To fully uninstall Playwright, you need to:

  • Remove the Playwright library from your project or environment.
  • Uninstall or delete the downloaded browsers using the Playwright CLI.
  • Optionally, clear any cached files or configuration folders that remain after removal.

Understanding these layers ensures a clean uninstall and prevents leftover files from consuming unnecessary disk space or causing version conflicts later.

Reasons to Uninstall Playwright

There are several reasons developers choose to uninstall Playwright, depending on their workflow and system requirements. Here are the most common ones:

  • Free up disk space: Playwright’s browser binaries (Chromium, Firefox, WebKit) can occupy hundreds of megabytes, which adds up over time.
  • Clean up old or unused projects: Removing Playwright helps declutter environments when a project is no longer in use.
  • Resolve version conflicts: Uninstalling before a fresh installation ensures compatibility and avoids dependency mismatches.
  • Switch testing frameworks: Teams migrating to other tools like Cypress, Selenium, or cloud-based platforms may remove Playwright to streamline setups.
  • Reset environment for troubleshooting: A clean uninstall often resolves corrupted installations or configuration errors.
  • Remove global or CI installations: Clearing Playwright from shared or automated environments prevents redundant downloads and reduces build size.

BrowserStack Automate Banner

General Uninstall Steps: Key Considerations

Before diving into language-specific commands, it’s important to understand the general process and considerations involved in uninstalling Playwright. Because Playwright includes both the core library and its own browser binaries, a complete uninstall requires removing both components to prevent leftover files or conflicts.

1. Identify installation type

Determine whether Playwright is installed locally in your project, globally on your system, or within a virtual/CI environment. The uninstall approach may differ slightly.

2. Uninstall the Playwright library

Use your package manager’s uninstall command to remove the main library:

  • Node.js → npm uninstall playwright or npm uninstall @playwright/test
  • Python → pip uninstall playwright
  • .NET → dotnet remove package Microsoft.Playwright

This ensures the dependency is also removed from configuration files like package.json or .csproj.

3. Remove downloaded browsers

Uninstalling the library doesn’t automatically delete the browser binaries Playwright installs (Chromium, Firefox, WebKit).

  • Use npx playwright uninstall –all (Node.js) or playwright uninstall (Python/.NET) to remove them.

4. Clean up caches and temporary files

Delete Playwright’s cache directories manually to free up space and prevent leftover files:

  • Windows → %USERPROFILE%\AppData\Local\ms-playwright
  • macOS → ~/Library/Caches/ms-playwright
  • Linux → ~/.cache/ms-playwright

5. Check for global or shared installs

If Playwright was installed globally or in CI/CD pipelines, remove those versions too to avoid conflicts or redundant browser downloads.

6. Verify removal

After uninstalling, confirm that the node_modules/playwright folder (or equivalent in other environments) and browser binaries have been deleted.

Following these steps ensures a complete and clean uninstall, leaving your system free of unused dependencies and large browser files.

Uninstall Playwright in Node.js / JavaScript / TypeScript

Uninstalling Playwright in a Node.js, JavaScript, or TypeScript project involves removing both the package and the browser binaries it installs. Here’s how to do it step-by-step:

1. Remove the Playwright package

If you installed Playwright as part of your test setup, uninstall it using npm or yarn:

npm uninstall playwright

Or, if you’re using the Playwright Test Runner:

npm uninstall @playwright/test

This removes the package from your node_modules folder and updates your package.json automatically.

2. Uninstall browser binaries

Removing the package alone doesn’t delete the browsers Playwright downloaded (Chromium, Firefox, and WebKit). To uninstall these browsers, run:

npx playwright uninstall

To remove all downloaded browsers and binaries, use:

npx playwright uninstall –all

3. Clean up cache and residual files (optional)

Playwright stores cached data and browser downloads in hidden directories. To fully clean your system, manually delete these folders:

  • Windows:%USERPROFILE%AppDataLocalms-playwright
  • macOS:~/Library/Caches/ms-playwright
  • Linux:~/.cache/ms-playwright

4. Verify uninstallation

Check your node_modules folder and confirm that Playwright-related directories (playwright, @playwright/test) are removed. You can also run:

npx playwright –version

If you see a “command not found” error, Playwright has been successfully uninstalled.

Uninstall Playwright in Python

Uninstalling Playwright in Python requires removing both the Playwright package and the browser binaries it installs. Follow these steps for a complete cleanup:

1. Uninstall the Playwright package

Use pip to remove Playwright from your environment:

pip uninstall playwright

This command removes the Playwright Python library from your system or virtual environment and updates your package records.

2. Uninstall browser binaries

Even after removing the library, the browsers (Chromium, Firefox, WebKit) remain on your system. You can uninstall them with the Playwright CLI:

playwright uninstall

To remove all browsers completely, use:

playwright uninstall –all

3. Clean cache and leftover files (optional but recommended):

Playwright stores browser data and temporary files in cache directories. You can manually delete them to free up disk space:

  • Windows: %USERPROFILE%AppDataLocalms-playwright
  • macOS: ~/Library/Caches/ms-playwright
  • Linux: ~/.cache/ms-playwright

4. Verify uninstallation:

You can confirm Playwright has been removed by running:

playwright –version

These steps ensure both the library and all browser assets are removed, leaving your Python environment clean and ready for a fresh setup or alternative testing framework.

Uninstall Playwright in .NET

Uninstalling Playwright in a .NET project involves removing both the Microsoft.Playwright NuGet package and the browser binaries it installs during setup. Follow these steps for a full cleanup:

1. Remove the Playwright NuGet package

Use the .NET CLI to uninstall the Playwright dependency from your project:

dotnet remove package Microsoft.Playwright

This command removes the package reference from your project file (e.g., .csproj) and deletes it from your local dependencies.

2. Uninstall browser binaries

Playwright for .NET installs browsers (Chromium, Firefox, WebKit) when you first run the project. To remove them, execute the PowerShell command from your project directory:

pwsh bin/Debug/netX/playwright.ps1 uninstall

To remove all downloaded browsers, use:

pwsh bin/Debug/netX/playwright.ps1 uninstall –all

3. Clean up cache and leftover files

Even after uninstalling, cached browser data may remain. You can safely delete these directories manually:

  • Windows: %USERPROFILE%AppDataLocalms-playwright
  • macOS: ~/Library/Caches/ms-playwright
  • Linux: ~/.cache/ms-playwright

4. Verify uninstallation:

Check your project file (.csproj) to ensure the Microsoft.Playwright reference is gone. You can also confirm by running:

dotnet list package

If Playwright is no longer listed, and browser folders have been removed, the uninstall was successful.

Uninstall Playwright from Docker / CI Environments

Uninstalling Playwright from Docker or Continuous Integration (CI) environments focuses on removing browser binaries, dependencies, and cached layers that increase image size or slow down builds.

Since Playwright is often preinstalled in CI pipelines for automated testing, careful cleanup ensures lighter, faster, and more maintainable environments.

Here’s how to do it effectively:

1. Identify where Playwright is installed

Check your Dockerfile or CI configuration (GitHub Actions, GitLab CI, Jenkins, etc.) for lines like:

RUN npm install playwright
RUN npx playwright install

Or

pip install playwright
playwright install

Note whether Playwright is installed globally, locally, or via your project dependencies.

2. Remove Playwright installation commands

  • Edit your Dockerfile or CI script to remove or comment out any lines that install Playwright or download browsers.
  • If Playwright is no longer needed, also remove related testing steps to prevent errors during builds.

3. Clean up existing Playwright layers in Docker

If Playwright was installed in a previous image layer, simply deleting the package in your code won’t shrink the image – you need to rebuild it.

Run:

docker system prune -a

This command removes unused images, containers, and cached layers, including any layers containing Playwright browsers.

Alternatively, rebuild your image without Playwright:

docker build –no-cache -t your-clean-image

4. Remove browser binaries and caches

Inside a container or CI environment, you can manually delete Playwright’s cache directories:

rm -rf ~/.cache/ms-playwright

This helps free up space from previously downloaded browsers.

5. Update CI dependencies

If you use Playwright in multiple jobs or shared runners, ensure it’s removed from dependency files and cache paths. For example, in GitHub Actions, clear the cache key associated with Playwright to avoid re-downloading binaries automatically.

6. Verify environment cleanup:

Run your build or test steps again. If Playwright commands are no longer recognized (e.g., playwright: command not found), it has been successfully uninstalled.

By removing Playwright from Docker and CI environments, you reduce image size, speed up builds, and eliminate unnecessary browser installations – making your pipelines leaner and more efficient.

Manually Cleaning Up Leftover Files

Even after uninstalling the Playwright package and browsers, some cache files and temporary data may remain on your system. These files can consume significant disk space over time, especially if you’ve used Playwright across multiple projects or versions. Cleaning them up manually ensures your environment stays lightweight and free from redundant data.

Here’s how to find and remove leftover Playwright files:

1. Locate cache directories

Playwright stores browser binaries, logs, and temporary data in specific directories based on your operating system:

Windows:

%USERPROFILE%AppDataLocalms-playwright

macOS:

~/Library/Caches/ms-playwright

Linux:

~/.cache/ms-playwright

2. Delete cache and browser folders manually

You can safely delete the entire ms-playwright folder. It only contains cached browsers and temporary files – no project-specific data.

  • On Windows, you can navigate via File Explorer and delete it manually.
  • On macOS or Linux, run:
rm -rf ~/.cache/ms-playwright

3. Check for additional project-level files

Some Playwright setups may create configuration or report folders inside your project directory, such as:

  • playwright-report/
  • test-results/
  • .playwright/ (hidden folder for temporary data)

You can remove these safely if you’re no longer using Playwright.

4. Clean up global installations (optional)

If you installed Playwright globally (e.g., via npm install -g playwright), remove it with:

npm uninstall -g playwright

This prevents conflicts if you reinstall it later.

5. Verify disk cleanup

After deletion, you can confirm the cleanup by checking your cache directory size or running a disk usage command, such as:

du -sh ~/.cache/ms-playwright

If the directory no longer exists or shows No such file or directory, your cleanup was successful.

By manually removing leftover Playwright files, you can reclaim disk space, prevent version conflicts, and ensure your development environment remains clean and efficient.

Try BrowserStack Automate: Alternative to Local Playwright Setups

When you’ve uninstalled Playwright locally, you don’t necessarily have to give up browser automation or end-to-end testing-you can simply shift where it runs. That’s where BrowserStack Automate comes in as a powerful alternative to managing Playwright setups on your own machines.

Instead of downloading and updating browsers yourself, you can run your Playwright tests directly on BrowserStack’s cloud, across thousands of real browsers, devices, and OS combinations.

It supports running Playwright tests at scale with massive parallel execution, detailed logs, videos, and debugging artifacts, plus seamless integration with popular CI/CD tools like GitHub Actions, Jenkins, CircleCI, and more.

Key advantages over local Playwright setups include:

  • No local browser maintenance: All browsers and OSes are hosted in the cloud, no more playwright install, updates, or heavy downloads on your machine.
  • Scale on demand: Run hundreds or thousands of Playwright tests in parallel to speed up feedback and reduce build times dramatically.
  • Real device coverage: Test on real desktop and mobile devices, including real iOS Safari and Android browsers, without setting up device labs.
  • Rich debugging & insights: Get videos, console logs, network logs, screenshots, and observability features in a single dashboard to quickly analyze failures.
  • Smooth integration with existing tests: You can plug in existing Playwright suites using BrowserStack’s SDK and sample repos, often with minimal or no code changes.

So, if you’ve uninstalled Playwright to reclaim space or reduce local complexity, running your Playwright tests on BrowserStack Automate lets you keep all the benefits of the framework, without the overhead of managing browsers and infrastructure yourself.

Talk to Expert

Common Pitfalls & Troubleshooting

Even though uninstalling Playwright is straightforward, developers often encounter small issues that lead to incomplete removal or lingering files. Below are some of the most common pitfalls and how to address them effectively:

1. Forgetting to uninstall browser binaries:

Many users remove the Playwright package but overlook the downloaded browser binaries, leaving large unused files behind.

Fix: Run npx playwright uninstall –all (Node.js) or playwright uninstall –all (Python/.NET) to remove all browsers completely.

2. Not deleting cache directories:

Playwright’s cache and browser data remain stored in system folders even after uninstalling.
Fix: Manually delete the cache directory:

  • Windows → %USERPROFILE%\AppData\Local\ms-playwright
  • macOS → ~/Library/Caches/ms-playwright
  • Linux → ~/.cache/ms-playwright

3. Confusing global and local installations:

Uninstalling Playwright from your project directory does not remove global installations.

Fix: If installed globally, use npm uninstall -g playwright to ensure full removal.

4. Version conflicts during reinstallation:

Reinstalling a newer version without fully uninstalling the previous one can lead to dependency errors or mismatched browser versions.

Fix: Always uninstall and clear caches before reinstalling Playwright.

5. Residual configuration and report files:

The uninstall process does not delete generated configuration or report folders such as playwright.config.ts, playwright-report/, or test-results/.

Fix: Manually remove these directories if Playwright is no longer in use.

6. Permission issues in CI/CD or Docker environments:

Cached browser directories may require elevated permissions for deletion in shared or containerized systems.

Fix: Run the cleanup command with appropriate permissions, such as sudo rm -rf ~/.cache/ms-playwright on Linux/macOS, or ensure proper user privileges in Docker builds.

By addressing these common pitfalls, you can ensure that Playwright and all its associated files are completely removed, preventing conflicts and keeping your environment clean for future testing setups.

Conclusion

Uninstalling Playwright requires more than simply removing a package, it involves cleaning up browser binaries, cached data, and configuration files to ensure your environment stays optimized and conflict-free. By following the outlined steps for your specific language or setup, you can achieve a complete and efficient uninstall.

Whether you are freeing up space, resolving version issues, or transitioning to a new testing framework, taking the time to properly remove Playwright ensures a smoother development experience. And if you still need robust browser automation without the maintenance overhead, cloud solutions like BrowserStack Automate provide an easy, scalable alternative to managing Playwright locally.

Try BrowserStack Now

Useful Resources for Playwright

Tool Comparisons:

Tags
Automation Testing Real Device Cloud Website Testing

Get answers on our Discord Community

Join our Discord community to connect with others! Get your questions answered and stay informed.

Join Discord Community
Discord