Skip to content

fix(docker): pin pnpm via corepack instead of installing the latest - #9

Closed
squarezw wants to merge 1 commit into
mainfrom
fix/pin-pnpm-via-corepack
Closed

fix(docker): pin pnpm via corepack instead of installing the latest#9
squarezw wants to merge 1 commit into
mainfrom
fix/pin-pnpm-via-corepack

Conversation

@squarezw

@squarezw squarezw commented Aug 5, 2026

Copy link
Copy Markdown
Owner

What happened

CI went red on 2026-08-05 with nothing changed in the repo:

[ERROR] Cannot verify the identity of the @pnpm/exe.linux-x64 native binary:
        it is missing from pnpm-lock.yaml

RUN npm install -g pnpm is unpinned, so every build installed whatever pnpm was newest at that moment. The 08-03 build was fine; by 08-05 pnpm 11 was out, and it verifies its own native binary against the lockfile — this lockfile came from 10.26.2 (lockfileVersion: '9.0') and has no such entry.

This is the nastiest failure mode: the repo is untouched, the build breaks anyway, and when it breaks depends on someone else's release schedule. "I didn't change anything" is literally true, which is exactly why it's hard to attribute — the first instinct is to look at the last commit, and the last commit is innocent.

The fix

package.json already declares packageManager: pnpm@10.26.2 (with a sha512). corepack reads it, so the version lives in exactly one place: bumping pnpm means editing package.json, and the Dockerfile can't drift from it.

Verified

Built the builder stage locally — pnpm install --frozen-lockfile succeeds, next build completes, and pnpm --version inside the image reports 10.26.2, matching packageManager. Not just "the build went green": the pinned version was confirmed in the image.

The same one-line problem exists in the private deployment repo and is fixed there identically, so the two Dockerfiles stay byte-identical in that block.

🤖 Generated with Claude Code

CI went red on 2026-08-05 with nothing changed in the repo:

    [ERROR] Cannot verify the identity of the @pnpm/exe.linux-x64 native
            binary: it is missing from pnpm-lock.yaml

`RUN npm install -g pnpm` is unpinned, so every build installed whatever pnpm was
newest at that moment. The 08-03 build was fine; by 08-05 pnpm 11 was out, and it
verifies its own native binary against the lockfile — this lockfile was produced by
10.26.2 (lockfileVersion 9.0) and has no such entry.

That failure mode is the nastiest kind: the repo is untouched, the build breaks
anyway, and *when* it breaks depends on someone else's release schedule. "I didn't
change anything" is literally true, which is exactly why it's hard to attribute.

`package.json` already declares `packageManager: pnpm@10.26.2` with a sha512.
corepack reads it, so the version is declared in exactly one place: bumping pnpm
means editing package.json, and the Dockerfile can't drift from it.

Verified by building the builder stage locally: install succeeds and
`pnpm --version` reports 10.26.2 inside the image.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@squarezw

squarezw commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

改用另一条路:不动 Dockerfile,改为把 lockfile 升到 pnpm 11(CI 装的就是最新版)。

@squarezw squarezw closed this Aug 5, 2026
@squarezw
squarezw deleted the fix/pin-pnpm-via-corepack branch August 5, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant