postinstall: playwright --with-deps fails on Fedora (apt-get not found)
Problem
The root package.json postinstall script is:
"postinstall": "npx playwright install chromium --with-deps || npx playwright install chromium --with-deps"
On Fedora (and presumably other non-Debian/Ubuntu Linux distros), Playwright's --with-deps flag falls back to an ubuntu24.04-x64 dependency profile and tries to shell out to apt-get, which doesn't exist:
BEWARE: your OS is not officially supported by Playwright; installing dependencies for ubuntu24.04-x64 as a fallback.
Installing dependencies...
Switching to root user to install dependencies...
sh: line 1: apt-get: command not found
Failed to install browsers
Error: Installation process exited with code: 127
The || fallback doesn't help since both sides of it run the identical --with-deps command and fail identically, so npm install exits non-zero on any non-Debian/Ubuntu system (this also affects npx @santifer/career-ops init, which shells out to npm install in the cloned repo).
Environment
- OS: Fedora 44 (x86_64)
- Node: (LTS,
>=18perengines)
Suggested fix
Drop --with-deps from the postinstall script (just npx playwright install chromium, which only downloads the browser binary, no system deps), and instead document the OS-specific system library install as an optional manual step for users who need it (e.g. in the README, similar to how PDF generation is already called out as optional). This avoids postinstall ever depending on a specific system package manager.
As a workaround, I resolved this manually with:
npx playwright install chromium
sudo dnf install -y alsa-lib atk cups-libs libdrm libXcomposite libXdamage libXfixes libXrandr mesa-libgbm pango libxkbcommon
Source: santifer/career-ops