fix(plugin-ci): replace npm 10.9.x on Node 22 runners - #3069
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: SignalK/signalk-server/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe reusable plugin CI workflow adds npm version checks to the Changesnpm version mitigation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The npm workaround matches the workflow’s documented version policy, with no supported merge-blocking issue identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
npm 10.9.x crashes while resolving an optional peer that is not being
installed:
npm error Cannot read properties of null (reading 'edgesOut')
at #loadPeerSet (@npmcli/arborist/lib/arborist/build-ideal-tree.js)
Any plugin depending on vitest reaches it through
@vitest/browser-playwright, so every Node 22 job fails at install before
a single test runs, whatever the pull request changed. It is upstream
npm/cli#9960 and #9787, both still open, and it is deterministic — the
install retry already in this workflow cannot clear it.
Both Node-setup jobs now replace that minor with npm 11. The version
test is an exact 10.9.* match rather than "older than 11": Node 20 ships
npm 10.8.2, which resolves the same tree cleanly, so upgrading it would
be churn that fixes nothing.
The range stops at 11 rather than tracking npm@latest. npm 12 requires
Node ^22.22.2, and `npm install -g` enforces an engine range with a hard
notsup failure rather than a warning, so @latest would fail this step
outright on a caller pinning an earlier 22.x — trading a crash that only
affects vitest users for one that affects everyone. npm 11 needs only
>=22.9.0 and fixes the crash. Within 11 the range floats, so patch
releases arrive without a change here.
Replacing npm rather than dropping Node 22 from the matrix keeps the job
testing a runtime plugins are still installed on: the crash is npm's,
not Node's.
0c3fab7 to
c2f9e14
Compare
|
Ready for human review |
Every
plugin-ci.ymlNode 22 job currently fails at dependency install, before a single test runs, for any plugin that depends on vitest — regardless of what the pull request changed.npm walks vitest's optional peer graph and crashes on
@vitest/browser-playwright, which is not itself being installed. It is upstream npm/cli#9960 and #9787, both still open.The retry helper already in this workflow cannot clear it: the crash is deterministic, not transient.
Scope
I hit this across several plugin repos and reproduced it on clean clones of their unmodified default branches, so it is not specific to one plugin or one pull request. Measured:
npm installSo the boundary is npm 10.9.x specifically — not Node 22, and not npm 10 generally.
The change
Both Node-setup jobs (the desktop matrix and the signalk-server integration matrix) replace that minor with npm 11.
The test is an exact
10.9.*match rather than "older than 11". Node 20 ships npm 10.8.2, which resolves the same tree cleanly, so upgrading it would be churn that fixes nothing — andsignalk-restricted-areasalready passes["20","22","24"], so a Node 20 caller is a live case rather than a hypothetical one.Why the range stops at 11 instead of tracking
npm@latestnpm 12 requires Node
^22.22.2 || ^24.15.0 || >=26.0.0, andnpm install -genforces an engine range with a hard failure, not a warning:A bare
"22"resolves to the latest 22.x today and would be fine, but a caller pinning an earlier 22.x would have this step fail outright — trading a crash that only affects vitest users for one that affects every caller on that Node. npm 11 requires only>=22.9.0, installs cleanly there, and fixes the crash.Within 11 the range floats (
npm@^11), so patch and minor releases arrive without a change here.I chose replacing npm over dropping Node 22 from the default matrix because the crash is npm's rather than Node's, and Node 22 is a runtime plugins are still installed on — dropping it would lose real coverage to work around a bug that a newer npm fixes outright.
Tested
Verified on Node 22 against a plugin that reproduces the crash, simulating exactly what the new step does:
npm installfails with theedgesOutcrash on both 22.22.0 (npm 10.9.4) and 22.23.2 (npm 10.9.8).npm install -g 'npm@^11'(resolves to 11.19.1): install succeeds (287 packages),npm run buildsucceeds, and the plugin's suite passes (52 tests across 6 files).npm install -g 'npm@^11'exits 0 on both 22.22.0 and 22.23.2;npm install -g npm@latestexits 1 on 22.22.0 with thenotsuperror above.10.9.*case matches 10.9.4 and 10.9.8 while leaving 10.8.2, 10.10.0, 11.19.1 and 12.0.2 untouched.plugin-ci.ymlparses as valid YAML.Not tested: a live run of this workflow on a GitHub runner, which needs the change to be on a branch the reusable workflow can be called from.
Summary
This PR pins npm 11.19.1 in both Node setup jobs of
plugin-ci.ymlwhennpm --versionmatches10.9.*.This avoids the npm Arborist crash during optional peer dependency resolution. It preserves older npm versions and Node 22 in the test matrix.
Dependency installation, build, 52 tests, and YAML parsing pass after the upgrade. A live GitHub Actions run is not performed.