Adds a short-circuit to prevent playwright install if OS is unsupported#13232
Adds a short-circuit to prevent playwright install if OS is unsupported#13232
Conversation
|
Thank you for the pull request, @weegeekps! ✅ We can confirm we have a CLA on file for you. |
|
Awesome, thanks for the PR @weegeekps! @jjspace Which distribution of Linux are you running? Could you give this a review and test? |
|
This is working for me locally on Mac. I ran: |
jjspace
left a comment
There was a problem hiding this comment.
The versions required for this script don't seem to match those listed on the system requirements docs
Node.js: latest 20.x, 22.x or 24.x.
Windows 11+, Windows Server 2019+ or Windows Subsystem for Linux (WSL).
macOS 14 (Ventura) or later.
Debian 12 / 13, Ubuntu 22.04 / 24.04 (x86-64 or arm64).
For example, Ubuntu 20 is not supported but this script allows it.
More importantly I would consider this function to be the true "source of truth"
https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/utils/hostPlatform.ts#L39
It'd be really nice if we could just use it directly but it doesn't seem to be exported anywhere or checkable with the CLI. The below works but generally I'd prefer to avoid importing directly from node_modules
import host from "../node_modules/playwright-core/lib/server/utils/hostPlatform.js";
const { isOfficiallySupportedPlatform } = host;I'm worried a bit about getting out of sync with the official list as time goes on and they drop support for more platforms.
The playwright team has also been very adamant (read: stubborn) about supporting any versions that are non-LTS, for Ubuntu that's any Odd versions. I'm on 25.10 which breaks when installing --with-deps because one "doesn't exist anymore" even though I already have it installed. This script currently does nothing to help me during npm install
I think it could be a good idea to add a section to the End to End Testing guide that playwright installation will have to be manual and per dev if they're not using a supported OS
Description
Playwright is not fully supported on every operating system or even every Linux distribution. This is most noticeable within the Linux world, where outside of Debian and Ubuntu, it ranges from unsupported to partially supported.
What this does is adds a check to the
preparestep inpackage.jsonto short circuit if being run on an unsupported system and quit before the playwright step.I've had this locally on my Fedora system for a little while now and it has worked well.
Issue number and link
No issue.
Testing plan
Tested this out on Fedora by just running
npm installwhich callsprepare.I haven't tested it on Windows, macOS, or Ubuntu.
Author checklist
CONTRIBUTORS.mdCHANGES.mdwith a short summary of my change