Skip to content

feat(node): support pnpm 11+ global bin directory layout#581

Merged
iloveitaly merged 3 commits into
railwayapp:mainfrom
iloveitaly:pnpm-home-everywhere
Jun 4, 2026
Merged

feat(node): support pnpm 11+ global bin directory layout#581
iloveitaly merged 3 commits into
railwayapp:mainfrom
iloveitaly:pnpm-home-everywhere

Conversation

@iloveitaly

@iloveitaly iloveitaly commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Motivation

pnpm 11 changed where global binaries are installed: they live under PNPM_HOME/bin instead of directly in PNPM_HOME. Railpack runs pnpm add -g node-gyp before install for mise-managed pnpm projects with native dependencies, and was putting /opt/pnpm on PATH for all pnpm versions. That breaks builds when engines.pnpm pins pnpm 11 (including x-range strings like "11.5.x").

Description

For pnpm 11+, the install step now adds PNPM_HOME/bin to PATH before the global node-gyp install. pnpm < 11 keeps using PNPM_HOME as before.

Version detection uses the mise-resolved pnpm version from the context resolver instead of parsing engines.pnpm directly, so x-range notation (e.g. "11.5.x") resolves to a concrete semver (e.g. 11.5.1) for the layout check without reimplementing npm range semantics.

Test

  • Unit tests for usesPnpmBinSubdir, including a case with a mise-resolved version string.
  • New examples/node-pnpm-11-engines example with engines.pnpm: "11.5.x" and an integration test that verifies Node and pnpm versions at runtime.
  • Build plan snapshot for the new example.

Links

Fixes #577

- Add a new example project to reproduce issues when using pnpm 11 in engines configuration with '.x' notation.
- Include a test definition to verify node and pnpm versions as detected by the environment.

Generated-by: aiautocommit
@iloveitaly iloveitaly changed the title pnpm home everywhere feat(node): support pnpm 11+ global bin directory layout Jun 4, 2026
* Resolve pnpm version via the context resolver to handle non-semver range notation (e.g., "11.5.x") found in `engines.pnpm`.
* Update global bin directory path for pnpm 11+ to `PNPM_HOME/bin` to ensure `node-gyp` installation succeeds.
* Add test case for resolved mise versions.

Generated-by: aiautocommit
@iloveitaly iloveitaly force-pushed the pnpm-home-everywhere branch from d763f07 to 6c4ad73 Compare June 4, 2026 10:21
@iloveitaly iloveitaly merged commit b1b3627 into railwayapp:main Jun 4, 2026
234 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.

pnpm 11 fails when using mise

1 participant