Skip to content

fix(browsers): record the alias when the build is already installed - #15694

Merged
samiyac merged 1 commit into
puppeteer:mainfrom
NgoQuocViet2001:fix-browsers-alias-cached-install
Nov 3, 2026
Merged

samiyac merged 1 commit into
puppeteer:mainfrom
NgoQuocViet2001:fix-browsers-alias-cached-install

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix.

Did you add tests for your changes?

Yes, in packages/browsers/test/src/chrome/install.test.ts.

If relevant, did you update the documentation?

Not needed.

Summary

install() returns early when the build is already in the cache, before the code that writes buildIdAlias to .metadata. For example, npx @puppeteer/browsers install chrome and then install chrome@canary both resolve to the same Canary build. The second command prints the installed path but stores no canary alias, so launch chrome@canary looks for chrome/linux-canary/..., which does not exist. An alias that already points to an older build keeps pointing there, which also affects npx puppeteer browsers install chrome@stable.

This writes the alias on the cached path as well. The write is skipped when the alias is already current, so re-running an install does not need a writable cache.

Does this PR introduce a breaking change?

No.

Other information

  • Ran: the new tests fail on main (alias undefined, stale 1.0.0.0) and pass with the fix; mocha for the Cache, uninstall, list, fileUtil, httpUtil, DefaultProvider, chrome/install, chrome/cli and chrome-data tests passes.
  • Checked: with a cached Canary build, install chrome@canary now stores the canary alias and launch chrome@canary resolves to the installed build; tsc -b, eslint and prettier are clean.

install() returned early when the requested build was already in the
cache, so a buildIdAlias such as `canary` or `stable` was never written
to .metadata (or kept pointing to an older build). `launch chrome@canary`
then resolved to a `linux-canary` folder that does not exist.

Write the alias on both the cached and the fresh install path. Skip the
write when the alias is already up to date so re-running an install does
not need a writable cache.
@samiyac
samiyac requested a review from OrKoN November 3, 2026 14:29
@samiyac
samiyac merged commit fa7bcdc into puppeteer:main Nov 3, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants