So you're on Arch and Playwright is being a pain? Yeah, same. Here's what happens:
$ npm init playwright@latest
BEWARE: your OS is not officially supported by Playwright; installing dependencies for ubuntu24.04-x64 as a fallback.
Installing dependencies...
sh: line 1: apt-get: command not found
Failed to install browsers
Error: Installation process exited with code: 127Playwright tries to use apt-get. On Arch. Good luck with that.
Even if you skip the auto-install and try manually:
$ npx playwright install chromium
BEWARE: your OS is not officially supported by Playwright; downloading fallback build for ubuntu24.04-x64.And then when you try to run tests:
$ npx playwright test --ui
Error:
╔═══════════════════════════════════════════════════╗
║ No chromium-based browser found on the system. ║
║ Please run the following command to download one: ║
║ ║
║ npx playwright install chromium ║
║ ║
║ <3 Playwright Team ║
╚═══════════════════════════════════════════════════╝You might try installing all the deps manually:
$ sudo pacman -S nss atk cups libxcomposite libxrandr libxdamage \
libxkbcommon libxfixes libxext libxshmfence mesa alsa-lib \
pango cairo gtk3 libdrm libxcb libx11 libxss libxtst
# ... all already installed, obviouslyStill doesn't work. The bundled Chromium just doesn't play nice with Arch. Library mismatches, missing symbols, the usual Arch-vs-Ubuntu fun.
The fix
Stop fighting it. Just use the Chromium you already have:
sudo pacman -S chromium(You should already have Chromium installed...right?....right?)
Then tell Playwright to use it in playwright.config.ts:
{
name: "chromium",
use: {
...devices["Desktop Chrome"],
launchOptions: {
executablePath: "/usr/bin/chromium",
},
},
},That's it. Tests run, life is good.
If you need it to work on CI too
CI boxes are usually Ubuntu, so the bundled browser works fine there. Quick conditional:
import { existsSync } from "fs";
const chromiumPath = existsSync("/usr/bin/chromium")
? "/usr/bin/chromium"
: undefined;
// then in your project config:
launchOptions: chromiumPath ? { executablePath: chromiumPath } : {},Firefox works the same way
sudo pacman -S firefoxlaunchOptions: {
executablePath: "/usr/bin/firefox",
},WebKit though? No standalone browser on Arch. Just test that one in CI.
Tested on Arch (kernel 6.17), Playwright 1.52+, Chromium 138+.