Skip to content

build: pin npm via packageManager to keep lockfile deterministic - #261

Merged
dhensby merged 1 commit into
masterfrom
build/pin-npm
Jul 27, 2026
Merged

build: pin npm via packageManager to keep lockfile deterministic#261
dhensby merged 1 commit into
masterfrom
build/pin-npm

Conversation

@dhensby

@dhensby dhensby commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

What

Pin the package manager to npm@10.9.8 via the packageManager field in package.json. No dependency versions change; the committed package-lock.json is unaffected.

Why

The open Dependabot PRs (#258, #259, #260) all fail CI at npm ci with:

npm error code EUSAGE
npm error Missing: conventional-commits-filter@6.0.1 from lock file

Root cause is an npm 10 vs 11 lockfile skew, not the dependency updates themselves:

  • npm 11 (what Dependabot currently uses to regenerate the lockfile) dedupes and omits the nested @commitlint/read/node_modules/conventional-commits-filter@6.0.1 entry.
  • npm 10 (what CI runs — Node 22 via .nvmrc bundles npm 10) keeps that nested entry, so its npm ci rejects an npm‑11‑generated lockfile as out of sync.

Verified empirically:

Lockfile generated by npm ci run by Result
npm 10 (current master) npm 10 ✅ in sync
npm 10 (current master) npm 11 ✅ accepted
npm 11 npm 10 Missing: conventional-commits-filter@6.0.1

Pinning packageManager to npm@10.9.8 makes lockfile generation deterministic across contributors and Dependabot, matching the npm that CI actually runs.

Caveat

This relies on Dependabot honouring the packageManager field when it regenerates lockfiles. If it does, rebasing #258/#259/#260 on top of this will produce npm‑10‑shaped lockfiles and CI will pass. If Dependabot does not honour it, those three PRs may still need their lockfiles regenerated with npm 10 directly.

Testing

  • master's lockfile is already npm‑10‑shaped, so this change is pin‑only — npm install --package-lock-only under npm 10.9.8 leaves the lockfile byte‑for‑byte unchanged.
  • npm ci under npm 10.9.8 passes on this branch.

Dependabot regenerates the lockfile with npm 11, which omits the nested
@commitlint/read/node_modules/conventional-commits-filter@6.0.1 entry
that npm 10 keeps. CI installs with the npm bundled in Node 22 (.nvmrc),
i.e. npm 10, whose `npm ci` then rejects an npm-11 lockfile with
"EUSAGE Missing: conventional-commits-filter@6.0.1 from lock file".

Pinning packageManager to npm@10.9.8 makes lockfile generation
deterministic across contributors and Dependabot, matching the npm that
CI actually runs. No dependency versions change and the committed
lockfile is unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dhensby
dhensby marked this pull request as ready for review July 27, 2026 14:11
@dhensby
dhensby merged commit 2f99354 into master Jul 27, 2026
14 checks passed
@dhensby
dhensby deleted the build/pin-npm branch July 27, 2026 14:12
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