Skip to content

fix(self-update): swap to pnpm package on Intel Mac when upgrading to v11+ - #11458

Merged
zkochan merged 1 commit into
v10from
fix/v10-self-update-darwin-x64
May 4, 2026
Merged

zkochan merged 1 commit into
v10from
fix/v10-self-update-darwin-x64

Conversation

@zkochan

@zkochan zkochan commented May 4, 2026

Copy link
Copy Markdown
Member

Summary

v10 backport companion to #11455 (which drops darwin-x64 from @pnpm/exe in v11).

When a v10 user on Intel macOS runs pnpm self-update and resolves a v11+ target, today's behavior would be:

  1. installPnpmToTools resolves @pnpm/exe@11.x from the registry.
  2. The v11 manifest no longer lists @pnpm/macos-x64 in optionalDependencies (per fix(exe): drop darwin-x64 artifact (upstream Node SEA bug) #11455), so no platform binary is installed.
  3. linkExePlatformBinary early-returns silently because node_modules/@pnpm/macos-x64/pnpm doesn't exist.
  4. linkBins runs but there's nothing useful to link — the user is left with no working pnpm.

This PR teaches v10's installPnpmToTools to detect that exact scenario (current pkg is @pnpm/exe, host is darwin-x64, target version is v11+) and transparently swap the install target from @pnpm/exe to the JS-only pnpm npm package. The pnpm package runs against the user's system Node.js, which on Intel Mac is the only path that still works.

Changes

tools/plugin-commands-self-updater/src/installPnpmToTools.ts:

  • Added targetPkgName derived from currentPkgName plus the host/version check. Threaded through getToolDirPath (so the install lives under the right tool dir), the pnpm add command, and the linkExePlatformBinary guard (skipped when not installing @pnpm/exe).
  • globalWarn printed when the swap happens, calling out that the new install requires Node.js on PATH and pointing at pnpm 11.0.3 standalone executable segfaults on Intel macOS (upstream Node.js SEA bug) #11423.
  • Added semver and @pnpm/logger imports (both already in dependencies / peerDependencies).

Plus a changeset.

What this is and isn't

  • Is: a one-shot migration path for existing v10 @pnpm/exe Intel-Mac users so they're not left with a broken bin shim after pnpm self-update. Future self-updates from the v11 pnpm package go through v11's own self-updater (which doesn't need this branch — it'll naturally re-install pnpm).
  • Is not: a fallback for users without Node.js on PATH. If they self-update and don't have Node available, the new bin shim will fail at the next invocation — but the alternative (silently leaving them with a broken @pnpm/exe) is strictly worse, and the warning at swap time tells them what's needed. v10 @pnpm/exe users typically already manage Node through pnpm env use, so this should be uncommon.

Compat

  • Linux / Windows / Apple Silicon Mac users: no change. The condition is currentPkgName === '@pnpm/exe' && process.platform === 'darwin' && process.arch === 'x64' && semver.major(pnpmVersion) >= 11.
  • Intel Mac on pnpm self-update 10.x (any v10 patch): no swap, install proceeds as before.
  • Intel Mac on pnpm self-update (no version → resolves latest, currently v11+): swap fires, warning printed, JS pnpm installed.
  • Intel Mac on pnpm self-update 11.0.5 (explicit v11): swap fires.

Test plan

  • pnpm test for @pnpm/tools.plugin-commands-self-updater — all 7 existing tests pass (the swap branch isn't triggered because the existing tests mock packageManager as pnpm@9.0.0).
  • pnpm run spellcheck clean.
  • pnpm run compile clean.
  • Manual verification on Intel Mac (no hardware available locally) — would appreciate a maintainer running PNPM_VERSION=11.0.5 pnpm self-update from a v10 @pnpm/exe install and confirming it produces a working pnpm shim.

References

… v11+

When self-updating from a v10 @pnpm/exe install on Intel macOS
(darwin-x64) to a v11+ version, transparently install the JS-only
"pnpm" npm package instead of @pnpm/exe.

@pnpm/exe v11+ no longer ships a darwin-x64 binary because Node.js
SEA injection produces a binary that segfaults on Intel Macs (upstream
nodejs/node#62893; #11423). Without this swap, self-update
would resolve @pnpm/exe@11.x, install a manifest with no platform
binary, and leave the user with a broken bin shim.

The new install requires Node.js on PATH; a globalWarn explains the
swap when it happens. All other host/version combinations are
unchanged. The targetPkgName is also threaded through getToolDirPath,
the `pnpm add` command, and the linkExePlatformBinary guard so the
new install lives under the correct tool directory and the
@pnpm/exe-specific platform-binary linking is skipped for the JS path.
@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 35da5a22-d78e-41cc-b5de-08c0212d2b80

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/v10-self-update-darwin-x64

Comment @coderabbitai help to get the list of available commands and usage tips.

@zkochan
zkochan merged commit c54bcfd into v10 May 4, 2026
14 checks passed
@zkochan
zkochan deleted the fix/v10-self-update-darwin-x64 branch May 4, 2026 19:27
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.

1 participant