fix(install): auto-install Chromium at runtime when postinstall skipped#110
Merged
Conversation
The 0.11.7 postinstall hook works when npm actually runs it, but plenty of installs skip lifecycle scripts (npm config ignore-scripts=true, npm 11+ default for global installs, monorepos with --ignore-scripts). Users got a friendly "run npx playwright install chromium" message but still had to run a second command before parity worked. Now launchBrowser catches the missing-browser error and runs `npx --yes playwright install chromium` inline with stdio inherited so the download progress is visible, then retries the launch once. The explicit-opt-out path is preserved via PARITY_SKIP_PLAYWRIGHT_INSTALL=1 for CI / Docker / monorepos that want strict control. Net effect: a fresh `npm i -g @decocms/parity && parity run …` works in one command even when lifecycle scripts are disabled. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
postinstallhook works when npm runs it, but plenty of installs skip lifecycle scripts (ignore-scripts=true, npm 11+ default for global installs, monorepos with--ignore-scripts). Result: users saw the friendly "runnpx playwright install chromium" message but still had to run a second command beforeparityworked.launchBrowsercatches the missing-browser error and runsnpx --yes playwright install chromiuminline with stdio inherited (so the download progress is visible), then retries the launch once.PARITY_SKIP_PLAYWRIGHT_INSTALL=1for CI / Docker / monorepos that want strict control.gh release create— the Publish workflow owns it.Test plan
bun run checkcleanbun run test— 701/701 passnpm i -g @decocms/parity@latest && parity run --preset smoke …works in one command on a fresh machine without a separatenpx playwright install chromium🤖 Generated with Claude Code
Summary by cubic
Automatically installs Chromium at runtime when Playwright’s binary is missing because install scripts were skipped. This lets
parityrun in one command on fresh machines and global installs.launchBrowser, detect missing Chromium and runnpx --yes playwright install chromiumwith inherited stdio, then retry once.PARITY_SKIP_PLAYWRIGHT_INSTALL=1to opt out for CI/Docker.Written for commit 182153b. Summary will update on new commits.