Playwright is a powerful browser automation library by Microsoft that enables web scraping, testing, and automation across multiple browsers. Here's a comprehensive guide to the system requirements for installing Playwright.
Core Requirements
1. Node.js
- Minimum Version: Node.js v18.0.0 or higher (recommended: latest LTS)
- Check version:
node --version
- Download: nodejs.org
2. Package Manager
- npm: Comes bundled with Node.js
- Yarn: Alternative package manager (optional)
- pnpm: Also supported for faster installs
3. Operating System Support
Windows - Windows 10 (1809+) or Windows 11 - Windows Server 2019 or 2022 - x64 and ARM64 architectures supported
macOS - macOS 10.15 (Catalina) or later - Intel and Apple Silicon (M1/M2) Macs supported
Linux - Ubuntu 18.04, 20.04, 22.04 - Debian 10, 11 - CentOS 7, 8 - Fedora 36+ - Alpine Linux 3.13+
System Dependencies
Windows & macOS
Dependencies are automatically installed during Playwright installation.
Linux
Manual installation of system dependencies is required:
Ubuntu/Debian:
# Install system dependencies
sudo apt-get update
sudo apt-get install -y \
libnss3 \
libatk-bridge2.0-0 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libgbm1 \
libxss1 \
libasound2
# For older Ubuntu versions (18.04)
sudo apt-get install -y \
libgtk-3-0 \
libnss3 \
libasound2 \
libgbm-dev
CentOS/RHEL/Fedora:
sudo yum install -y \
nss \
atk \
at-spi2-atk \
gtk3 \
alsa-lib \
libdrm \
libxkbcommon \
libxcomposite \
libxdamage \
libxrandr \
mesa-libgbm \
libXScrnSaver
Alpine Linux:
apk add --no-cache \
chromium \
nss \
freetype \
freetype-dev \
harfbuzz \
ca-certificates \
ttf-freefont
Browser Requirements
Playwright automatically downloads and manages browser binaries:
- Chromium: Latest stable version
- Firefox: Latest stable version
- WebKit: Latest stable version (Safari engine)
- Storage: ~300MB per browser (~900MB total)
Installation
Standard Installation
# Using npm
npm install playwright
# Using Yarn
yarn add playwright
# Using pnpm
pnpm add playwright
Install with Browsers
# Install browsers automatically
npx playwright install
# Install specific browser
npx playwright install chromium
npx playwright install firefox
npx playwright install webkit
# Install system dependencies (Linux)
npx playwright install-deps
Development Installation
# Install as dev dependency
npm install --save-dev playwright
# Install with test runner
npm install --save-dev @playwright/test
Hardware Requirements
Minimum Requirements
- RAM: 2GB available memory
- Storage: 1GB free space (for browsers)
- CPU: Any modern x64 or ARM64 processor
Recommended Requirements
- RAM: 4GB+ for parallel test execution
- Storage: 2GB+ for multiple browser versions
- CPU: Multi-core processor for faster execution
Verification
After installation, verify Playwright is working:
# Check Playwright version
npx playwright --version
# Verify browser installations
npx playwright install --dry-run
# Run a simple test
node -e "const { chromium } = require('playwright'); (async () => { const browser = await chromium.launch(); console.log('Playwright is working!'); await browser.close(); })();"
Docker Support
Playwright provides official Docker images:
FROM mcr.microsoft.com/playwright:v1.40.0-focal
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "test"]
Troubleshooting
Common Issues: - Missing system dependencies on Linux - Insufficient disk space for browser downloads - Firewall blocking browser downloads - Old Node.js version compatibility
Solutions:
# Clear Playwright cache
npx playwright install --force
# Install with verbose logging
DEBUG=pw:install npx playwright install
# Check system dependencies
npx playwright install-deps --dry-run