Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[rush] With pnpm 12, `rush update` does not update pnpm-lock.yaml after pnpm changes a peer variant

Offen
#6,117 0 Kommentare 12 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@brunojppb arbeitet bereits daran.

Seit 07.10.2026.

  • #6119 von @brunojppb — offen

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
node.js, typescript

Rechercherichtung

Start with libraries/rush-lib/src/logic/base/BaseInstallManager.ts, especially the lockfile-copy check around the linked line 273, and trace how rush update handles the temporary and committed pnpm lockfiles. Use the supplied reproduction script to verify behavior with pnpm 11 and 12. Done means rush update keeps the committed lockfile in sync when pnpm changes a peer variant, and the reproduction’s subsequent rush install links the version recorded there.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Summary

We tried to move our Rush monorepo from pnpm 11 to pnpm 12. We changed only pnpmVersion in rush.json and ran rush update. A type check then failed because a package linked the wrong graphql version.

pnpm 12 picked a different peer variant and wrote it to common/temp/pnpm-lock.yaml. Rush did not copy that file to common/config/rush/pnpm-lock.yaml. The committed lockfile now records one version, and node_modules links another. rush install in a new clone links the same wrong version.

Repro steps

Repository: https://github.com/brunojppb/rush-pnpm-12-lockfile-issue

  1. Use Node 24.
  2. Clone the repository.
  3. Run ./repro.sh.

The script needs no global rush. It runs common/scripts/install-run-rush.js and does these steps:

  1. app depends on [email protected]. The script runs rush update with pnpm 11.24.0.
  2. The script removes graphql from app. It runs rush update with pnpm 11.24.0 again.
  3. The script sets pnpmVersion to 12.10.1. It runs rush update.
  4. The script runs rush purge, then rush install.

app also depends on @graphql-typed-document-node/[email protected], which has a peer dependency on graphql.

Expected result: After step 3, common/config/rush/pnpm-lock.yaml records [email protected] for that peer. This is the version in common/temp/pnpm-lock.yaml and node_modules. After step 4, node_modules links the version that the committed lockfile records.

Actual result: rush update reports success, but the committed lockfile does not change:

== 3. Set pnpm to 12.10.1, then run rush update
temp lockfile:      [email protected]
committed lockfile: [email protected]
node_modules:       [email protected]
committed lockfile changed: no

== 4. Run rush purge, then rush install with pnpm 12.10.1
committed lockfile: [email protected]
node_modules:       [email protected]

== Result
BUG: the committed lockfile records [email protected], but node_modules links [email protected].

Details

After step 2, the peer variant is [email protected]. This version does not satisfy the peer range ^17.0.0. pnpm 11 keeps the old peer variant. pnpm 12 resolves the peer again and picks [email protected]. pnpm 12 writes this version to common/temp/pnpm-lock.yaml.

Rush copies common/temp/pnpm-lock.yaml to common/config/rush/pnpm-lock.yaml only when its own check finds the lockfile out of date. In this case, the package.json files did not change, so Rush skips the copy. BaseInstallManager.ts has this comment in the branch that skips the copy:

https://github.com/microsoft/rushstack/blob/e2341a3fcacd6a25263e4c35ccd7c9fdda676e3b/libraries/rush-lib/src/logic/base/BaseInstallManager.ts#L273

rush install has a related problem. By default, it gives pnpm the --no-prefer-frozen-lockfile option. pnpm 12 then resolves the peers again and does not follow the committed lockfile.

Workarounds.

  • rush update --recheck copies the temp lockfile to the committed lockfile.
  • "usePnpmFrozenLockfileForRushInstall": true in common/config/rush/experiments.json makes rush install give pnpm --frozen-lockfile. pnpm then follows the committed lockfile. This setting does not change rush update.
Potential fix
  • After rush update runs pnpm, Rush could compare the temp lockfile with the committed lockfile. If the two files differ, Rush could copy the temp lockfile.
  • For rush install, Rush could use --frozen-lockfile with pnpm 12. Another option: Rush could fail when pnpm changes the temp lockfile during rush install.

Standard questions

Question Answer
@microsoft/rush globally installed version? None. The repro runs common/scripts/install-run-rush.js.
rushVersion from rush.json? 5.181.0
pnpmVersion, npmVersion, or yarnVersion from rush.json? [email protected] (the repro starts with [email protected])
(if pnpm) useWorkspaces from pnpm-config.json? true
Operating system? Mac (macOS 26.6.2)
Would you consider contributing a PR? TODO
Node.js version (node -v)? 24.21.0
Vorherrschende Sprache
TypeScript
Sterne
6.5k
Forks
710
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
47

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/rushstack

Alle Issues in microsoft/rushstack

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.