Skip to content

[rush] Subspaces + pnpm 11: cross-subspace workspace:* deps fail — global-pnpmfile is wired via .npmrc, which pnpm 11 ignores #5912

Description

@QuanticPotatoes

Summary

With subspaces enabled and pnpm 11, rush install / rush update fails on any subspace that carries a cross-subspace workspace:* dependency:

ERR_PNPM_WORKSPACE_PKG_NOT_FOUND  In ../../../apps/api: "@my/tooling-package@workspace:*" is in the dependencies but no package named "@my/tooling-package" is present in the workspace

This is the other half of #5837 / #5838: those relocated the settings (globalOverrides, minimumReleaseAge, patches…) from package.json / .npmrc to the generated pnpm-workspace.yaml for pnpm 11 — but the subspace global pnpmfile (the shim that rewrites cross-subspace workspace:* specifiers to link: specifiers) is still wired up via the generated .npmrc:

https://github.com/microsoft/rushstack/blob/main/libraries/rush-lib/src/logic/base/BaseInstallManager.ts#L540-L542

extraNpmrcLines.push(
  `global-pnpmfile=${subspace.getSubspaceTempFolderPath()}/${RushConstants.pnpmfileGlobalFilename}`
);

pnpm 11 only reads auth/registry settings from .npmrc (pnpm settings), so this line is silently ignored, the shim never loads, and the workspace:* rewrite never happens.

Repro

  • Rush 5.178.0 (includes [rush] Relocate pnpm settings to pnpm-workspace.yaml for pnpm 11 #5838), monorepo with subspacesEnabled: true
  • A project in subspace A depending on a project that lives in the default subspace via "workspace:*"
  • rush.json: "pnpmVersion": "11.17.0"rush updateERR_PNPM_WORKSPACE_PKG_NOT_FOUND on the first subspace install
  • Same repo with "pnpmVersion": "10.34.5" → installs fine (the .npmrc line is honored)

Verified fix direction

The generated global-pnpmfile.cjs itself works fine under pnpm 11 — only the wiring is dead. Both of these make the same failing install succeed (tested against pnpm 11.17.0):

  • appending globalPnpmfile: <subspace temp folder>/global-pnpmfile.cjs to the generated pnpm-workspace.yaml (pnpm 11 still supports the globalPnpmfile setting — and unlike pnpmfile, setting it does not disable the default .pnpmfile.cjs loading, so the per-subspace user pnpmfile shim keeps working);
  • passing --config.pnpmfile=global-pnpmfile.cjs on the pnpm command line.

The first mirrors exactly what #5838 did for the other settings: for pnpm 11+, emit globalPnpmfile through PnpmWorkspaceFile (keeping the .npmrc line for pnpm ≤ 10, unchanged behavior).

I have a PR ready for this — opening it right after this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions