Skip to content

Commit 6a0bcb4

Browse files
committed
ci: fix npm publish — use Node 24 instead of upgrading npm in place
`npm install -g npm@latest` overwrites the npm shipped in the runner's toolcache. With recent npm releases this leaves npm's own bundled dependencies half-replaced, and `npm publish --provenance` then fails with: npm error code MODULE_NOT_FOUND npm error Cannot find module 'sigstore' The step existed because Trusted Publishing (OIDC) requires npm >= 11.5.1 and Node 22 ships npm 10.x. Node 24 already bundles npm 11.x, so the in-place upgrade is unnecessary. Bump the runtime and drop the step. This broke between 2026-05-22 (last successful publish) and today, from a new npm release rather than from any change in this repository. No package was published by the failed run: npm still serves 1.0.6.
1 parent 50d08a3 commit 6a0bcb4

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ jobs:
4141
- name: Set up Node.js
4242
uses: actions/setup-node@v4
4343
with:
44-
node-version: '22'
44+
# Node 24 bundles npm >= 11.5.1, which Trusted Publishing (OIDC) requires.
45+
# Do NOT upgrade npm in place with `npm install -g npm@latest`: overwriting the
46+
# toolcache npm leaves its bundled dependencies half-replaced, and `npm publish
47+
# --provenance` then dies with "Cannot find module 'sigstore'".
48+
node-version: '24'
4549
cache: 'npm'
4650
# No registry-url: prevents setup-node from writing an _authToken line into
4751
# .npmrc, which would shadow the OIDC token exchange done by Trusted Publisher.
4852

49-
- name: Upgrade npm to an OIDC-capable version
50-
# Trusted publishing (OIDC) requires npm >= 11.5.1; Node 22 ships with npm 10.x.
51-
run: npm install -g npm@latest
53+
- name: Show npm version
54+
run: npm --version
5255

5356
- name: Install dependencies (skip optional native modules)
5457
run: npm ci --omit=optional

0 commit comments

Comments
 (0)