[rush] With pnpm 12, `rush update` does not update pnpm-lock.yaml after pnpm changes a peer variant
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- node.js, typescript
- 領域
- build-system, tooling
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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
- Use Node 24.
- Clone the repository.
- Run
./repro.sh.
The script needs no global rush. It runs common/scripts/install-run-rush.js and does these steps:
appdepends on[email protected]. The script runsrush updatewith pnpm 11.24.0.- The script removes
graphqlfromapp. It runsrush updatewith pnpm 11.24.0 again. - The script sets
pnpmVersionto 12.10.1. It runsrush update. - The script runs
rush purge, thenrush 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:
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 --recheckcopies the temp lockfile to the committed lockfile."usePnpmFrozenLockfileForRushInstall": trueincommon/config/rush/experiments.jsonmakesrush installgive pnpm--frozen-lockfile. pnpm then follows the committed lockfile. This setting does not changerush update.
Potential fix
- After
rush updateruns 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-lockfilewith pnpm 12. Another option: Rush could fail when pnpm changes the temp lockfile duringrush 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 |
- 主要語言
- TypeScript
- 星號
- 6.5k
- 分支
- 710
- 平均合併
- 1 天 23 小時
- 30 天內合併 PR
- 47
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/rushstack 的其他 Issue
-
[rush] Upgrade the pnpm-sync-lib dependency to 0.3.5.可能已有人在做 @martinnaj 於 8 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
microsoft/rushstack#5971 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
microsoft/rushstack#5902 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/rushstack#5839 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
microsoft/rushstack#5683 · 3 則留言 ·
維護者通常 1 天內回覆
-
[rush] Managed Git LFS hooks conflict with reused Azure Pipelines workspaces可能已有人在做 @iclanton 今天認領。 未關閉
microsoft/rushstack#6120 · 1 個 reaction · 已指派 2 人 ·
維護者通常 1 天內回覆
查看 microsoft/rushstack 的全部 Issue
相似的 Issue
-
[bug] diagnostics.dumpBody:Buffer 形态请求(透传 lane)跳过 dumps/ 落盘,仅留 raw/-unknown-可能已有人在做 @ranxianglei 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 62/100
ranxianglei/billion-context#2421 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
platformatic/mcp#216 ·
維護者通常 1 天內回覆
-
pending triage
難度 2/5 1-3 小時 新手友好度 76/100
nuxt/test-utils#1842 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
MoonshotAI/kimi-code#4146 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
farbenmeer/tapi#531 ·