SoftwareTestPilot
Module 01 · Lesson 2beginner 8 min read Setup

Install Playwright with Node.js & VS Code

A 10-minute setup guide for Windows, macOS and Linux. Get Node, VS Code and Playwright running with a working example test — plus fixes for every common install failure.

Quick answer

Run these three commands to install Playwright with a working example test:

# 1. Install Node.js 20 LTS from https://nodejs.org
# 2. Create a project and scaffold Playwright
mkdir my-qa-project && cd my-qa-project
npm init playwright@latest
# 3. Run the example test
npx playwright test

Prerequisites

  • A machine running Windows 10+, macOS 12+, or Ubuntu 20.04+
  • Admin / sudo rights to install software
  • At least 2 GB free disk (browsers take ~1 GB)
  • Internet access to download Node and Playwright browsers
No coding background?
You don't need JavaScript yet. Lesson 3 explains every line of code. This lesson only sets up the tools.

1. Install Node.js 20 LTS

  1. 1

    Download the LTS installer

    Go to nodejs.org and pick the LTS download. In 2026 that's Node 20.x. Avoid the "Current" build — Playwright targets LTS.

  2. 2

    Run the installer

    Accept the defaults on Windows/macOS. On Linux, prefer nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash && nvm install --lts.

  3. 3

    Verify

    node --version   # v20.x.x
    npm --version    # 10.x.x

2. Install VS Code and the Playwright extension

  1. 1

    Download VS Code

    From code.visualstudio.com. Any recent build is fine.

  2. 2

    Install the official Playwright extension

    Open VS Code → Extensions (Ctrl+Shift+X) → search "Playwright Test for VSCode" by Microsoft → Install. This adds the green ▶ gutter icons, the Testing sidebar and the record-a-test button.

3. Scaffold a Playwright project

Create an empty folder and run the official scaffolder:

mkdir my-qa-project && cd my-qa-project
npm init playwright@latest

The wizard asks four questions — recommended answers:

  • TypeScript or JavaScript? → TypeScript
  • Where to put your tests?tests
  • Add a GitHub Actions workflow? → Yes
  • Install browsers? → Yes (downloads Chromium, Firefox and WebKit)

You'll end up with this structure:

my-qa-project/
├── .github/workflows/playwright.yml
├── tests/
│   └── example.spec.ts
├── tests-examples/
├── playwright.config.ts
├── package.json
└── package-lock.json

4. Run the example test

npx playwright test              # runs headless in all 3 browsers
npx playwright test --ui         # opens the UI Mode (recommended)
npx playwright test --headed     # see the browser
npx playwright show-report       # last HTML report

You should see something like:

Running 6 tests using 6 workers
  6 passed (7.3s)

To open last HTML report run:
  npx playwright show-report
Use UI Mode from day one
npx playwright test --ui gives you time-travel debugging, live locator picking and watch mode. It's the single biggest productivity boost — don't skip it.

5. Troubleshooting common errors

Error: 'command not found: npx'

Node isn't on your PATH. Reopen the terminal, or on Windows re-run the installer and tick "Add to PATH".

Error: 'Playwright: browserType.launch: Executable doesn't exist'

Browsers didn't download. Run:

npx playwright install
# On Linux CI also needed:
npx playwright install --with-deps

Behind a corporate proxy

# macOS / Linux
export HTTPS_PROXY=http://user:pass@proxy.company.com:8080
export HTTP_PROXY=$HTTPS_PROXY
npx playwright install

# Windows PowerShell
$env:HTTPS_PROXY="http://user:pass@proxy.company.com:8080"
npx playwright install

Or point at an internal mirror: PLAYWRIGHT_DOWNLOAD_HOST=https://mirror.company.com.

Slow / hanging install on Linux

Missing OS libs. Run sudo npx playwright install-deps. On Ubuntu 24.04 you may also need sudo apt install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2.

6. Hands-on task (5 minutes)

  1. 1

    Open UI Mode

    Run npx playwright test --ui. Click any test to run it and use the time-travel slider.

  2. 2

    Break something on purpose

    Open tests/example.spec.ts and change expect(page).toHaveTitle(/Playwright/) to /BrokenTitle/. Save. Watch UI Mode re-run and show the diff.

  3. 3

    Restore and commit

    Fix the assertion, then git init && git add . && git commit -m "chore: scaffold Playwright". You now have a real Playwright project.

7. What's next

Setup done. Now write a real end-to-end test from scratch in Module 1 / Lesson 3: Your First Playwright Test.

Docs: playwright.dev/docs/intro · Node.js downloads

Frequently asked questions

1.Which Node.js version does Playwright need?
Playwright 1.40+ requires Node.js 18 LTS or newer. Node 20 LTS is recommended in 2026. Don't use Node 16 — it is out of support and Playwright will warn on install.
2.Do I need to install Chrome, Firefox and Safari separately?
No. `npx playwright install` downloads pinned versions of Chromium, Firefox and WebKit into your project's browser cache. They don't touch your system browsers.
3.What's the difference between `npm init playwright` and `npm install @playwright/test`?
`npm init playwright@latest` is the scaffolder — it creates the config, example test, GitHub Actions workflow and installs browsers in one shot. `npm install @playwright/test` only installs the library; you'd wire up the rest manually.
4.Where do Playwright browsers get installed?
On macOS: `~/Library/Caches/ms-playwright`. On Linux: `~/.cache/ms-playwright`. On Windows: `%USERPROFILE%\AppData\Local\ms-playwright`. Delete this folder if browsers get corrupted, then re-run `npx playwright install`.
5.Playwright install failed behind a corporate proxy — what do I do?
Set the `HTTPS_PROXY` env var before install, or point Playwright at an internal mirror with `PLAYWRIGHT_DOWNLOAD_HOST`. See the troubleshooting section below for the exact commands.
6.Do I need TypeScript or can I use plain JavaScript?
Both work. `npm init playwright` asks you at scaffold time. TypeScript is recommended because Playwright's autocomplete and refactoring are dramatically better with types — and every 2026 job posting expects it.

Related lessons