Skip to content

[rush] Add PNPM v10 support: SHA256 hashing for dependencies paths lookup and new 'virtual-store-dir-max-length' #5236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

uprtdev
Copy link

@uprtdev uprtdev commented May 22, 2025

This PR solves compatibility issues between Rush and PNPM v10. In PNPM v10, the hashing algorithm for dependency paths was changed to SHA256, and the default virtual-store-dir-max-length was reduced from 120 to 60 characters. These upstream changes caused Rush-based projects using PNPM v10 to fail during the linking stage, with errors such as:

ERROR: Internal Error: Cannot find installed dependency "..." in ...
You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.

This update enables Rush to correctly support PNPM v10 by updating its dependency on @pnpm/dependency-path and by adjusting logic to account for the new default max-length value.

Fixes #5235

How was the problem solved?

Updated the rush-lib dependencies to include the latest @pnpm/dependency-path package that uses SHA256 hashing, which is required for PNPM v10.
Modified PnpmLinkManager to detect PNPM v10 and use the updated hashing and the new default virtual-store-dir-max-length (60), while retaining existing logic for PNPM v9 (using 120).
The code dynamically imports the correct version of @pnpm/dependency-path based on the detected PNPM major version.

Scope of the solution:

This change fully solves the issue for both PNPM v9 and v10

Backwards compatibility:

This change is backwards compatible. The logic for PNPM v9 is unchanged, and new logic is only applied for PNPM v10 and above.

Performance impact:

No performance regressions are expected; the code path remains similar, only adapting to new PNPM requirements.

Testing

Manual testing was performed on the final commit. I ran the following commands on our production monorepo with both PNPM v10 and PNPM v9 to verify correct behavior and ensure no regressions:

  • rush update
  • rush install
  • rush build

All works good, and no new issues were observed.

@uprtdev
Copy link
Author

uprtdev commented May 22, 2025

@microsoft-github-policy-service agree company="Microsoft"

Comment on lines 17 to 20
{
"name": "@pnpm/dependency-path-lockfile-pre-v10",
"allowedCategories": [ "libraries" ]
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in nonbrowser-approved-packages.json

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

I can see that the old @pnpm/dependency-path-lockfile-pre-v9 is not mentioned in any of these files, but the new one was added by rush update command, so I kept it.

@iclanton iclanton moved this from Needs triage to In Progress in Bug Triage May 28, 2025
@uprtdev uprtdev requested a review from iclanton May 28, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

[rush] PNPM 10.x support
2 participants