Here is the **definitive, consolidated guide** for setting up Playwright on **Arch Linux (WSL)**.
This summary skips the trial-and-error we just went through and provides the "Happy Path" to get everything working in one go.
---
### 📋 Prerequisites
***WSL 2** (Recommended).
***Proxy (Optional):** If you are behind a proxy, remember to use `sudo -E` to preserve environment variables.
---
### 🚀 Step 1: System Prep & Node.js
First, ensure your package database is fresh (fixes 404 errors) and install Node.js.
```bash
# Update system and install Node.js/npm
# Use -E if you have https_proxy set in your shell
sudo -E pacman -Syu nodejs npm
```
### 📦 Step 2: Install System Dependencies (The Critical Step)
**Do not** use `npx playwright install-deps` (it fails on Arch). Instead, install these packages manually. This list includes all the X11, Graphics, and Network libraries required by Chromium, Firefox, and WebKit.
```bash
sudo -E pacman -S --needed \
git \
nss \
nspr \
libdrm \
alsa-lib \
mesa \
gtk3 \
at-spi2-core \
pango \
cairo \
gdk-pixbuf2 \
libx11 \
libxcomposite \
libxdamage \
libxext \
libxfixes \
libxrandr \
libxcursor \
libxi \
libxrender \
libxcb \
freetype2 \
fontconfig \
ffmpeg
```
### 🛠️ Step 3: Initialize Playwright
Set up your project and download the browser binaries (these are separate from the system libs above).
```bash
# Create project directory
mkdir my-tests &&cd my-tests
# Initialize (Select TypeScript/JavaScript as preferred)
npm init playwright@latest
# If prompted to "Install Playwright browsers", select True.