I am packaging robotframework-browser using Nix and playwright-driver. The issue is that playwright-driver.browsers provides fixed browser binaries, but the Playwright npm package hardcodes compatible browser versions. Currently, I manually patch package.json and update the lock file to align versions, which is tedious and error-prone. Is there a recommended approach to automatically handle version synchronization while using PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS to bypass host checks?
Playwright provides environment variables to control browser installation. You can predefine the browser versions in your environment instead of patching manually:
PLAYWRIGHT_BROWSERS_PATH=/path/to/fixed/browsers
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=1
npm install playwright
Then robotframework-browser will pick up the preinstalled binaries automatically, keeping versions aligned.
Instead of patching manually every time, pin the playwright npm dependency to the version that matches playwright-driver.browsers in your package.json:
“dependencies”: { “playwright”: “1.44.0” // match the version your driver expects }
Then run npm ci instead of npm install to strictly respect the lock file. This ensures that your Playwright package always matches the fixed browser binaries.
You can create a small automation script that:
Reads the browser version from playwright-driver.browsers.
Updates the playwright version in package.json and lock file.
Runs npm ci to install the correct version.
This reduces manual steps and ensures consistent builds, especially in CI/CD pipelines. You can integrate it with Nix builds to make it fully reproducible.