feat(node): support pnpm 11+ global bin directory layout#581
Merged
Conversation
- 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
Generated-by: aiautocommit
* 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
d763f07 to
6c4ad73
Compare
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.
Motivation
pnpm 11 changed where global binaries are installed: they live under
PNPM_HOME/bininstead of directly inPNPM_HOME. Railpack runspnpm add -g node-gypbefore install for mise-managed pnpm projects with native dependencies, and was putting/opt/pnpmonPATHfor all pnpm versions. That breaks builds whenengines.pnpmpins pnpm 11 (including x-range strings like"11.5.x").Description
For pnpm 11+, the install step now adds
PNPM_HOME/bintoPATHbefore the globalnode-gypinstall. pnpm < 11 keeps usingPNPM_HOMEas before.Version detection uses the mise-resolved pnpm version from the context resolver instead of parsing
engines.pnpmdirectly, 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
usesPnpmBinSubdir, including a case with a mise-resolved version string.examples/node-pnpm-11-enginesexample withengines.pnpm: "11.5.x"and an integration test that verifies Node and pnpm versions at runtime.Links
Fixes #577