fix(docker): install Node 22 from NodeSource to match install.sh - #22481
wesleysimplicio wants to merge 1 commit into
Conversation
Debian 13's apt-shipped nodejs is 20.x. At least one transitive web/ dep (language-tags@2.1.0) requires Node >= 22, but npm only WARNs on engine mismatch — the install completes, the resolver chain breaks silently, and the Vite build fails with a misleading 'can't resolve clsx' error. scripts/install.sh already pins NODE_VERSION="22"; this aligns the Dockerfile so the container build matches the host installer. Adds two static guards in tests/test_dockerfile_node_version.py: * Dockerfile must install Node from NodeSource (not Debian apt) * NodeSource major must equal install.sh's NODE_VERSION pin Closes NousResearch#21656
There was a problem hiding this comment.
Pull request overview
Aligns the container build with the project’s installer by ensuring the Docker image installs Node.js 22 from NodeSource (matching scripts/install.sh), preventing web/ dependency engine mismatches that can surface later as misleading Vite/Rollup errors.
Changes:
- Update
Dockerfileto install Node.js via NodeSourcesetup_22.x(and add required apt deps for key retrieval). - Add static (text-only) pytest guards to ensure the Dockerfile uses NodeSource and stays in sync with
scripts/install.sh’sNODE_VERSION.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
Dockerfile |
Switches Node installation from Debian apt Node 20.x to NodeSource Node 22 to match installer expectations. |
tests/test_dockerfile_node_version.py |
Adds CI guards to prevent Node version/source drift between Dockerfile and scripts/install.sh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Node 22 is installed from NodeSource so the image matches the Node version | ||
| # pinned by scripts/install.sh (NODE_VERSION="22"). Debian 13's apt-shipped | ||
| # nodejs is 20.x, and at least one transitive web/ dep (language-tags@2.1.0) | ||
| # requires Node ≥22. npm only WARN-s on engine mismatch, so the install |
|
Closing — the underlying issue (Debian 13 ships Node 20.x and Main's Dockerfile (line 9) uses a multi-stage source image: Landed in commit 27a29ee ( Your test guard ( |
What does this PR do?
Closes #21656.
Root cause
Debian 13's apt-shipped
nodejspackage is 20.x. At least one transitiveweb/dep (language-tags@2.1.0) requires Node >= 22. npm only WARNs onengine mismatch, so the install completes but the resolver chain breaks
silently and the Vite build dies with a misleading
can't resolve clsxerror.
scripts/install.shalready pinsNODE_VERSION="22". The Dockerfilewas still installing Node from apt, so the container build drifted from
the host installer.
Fix
Dockerfilenow installs Node from NodeSource'ssetup_22.xscript(adds
gnupg+ca-certificatesto the base apt layer for the GPG keyfetch). No other layer touched.
Why this shape
This shape mirrors #29640 so reviewers can quickly compare scope, root cause, fix, tests, and related context without having to decode a custom PR description.
Tests
Original body
Related PRs / issues
Closes #21656.
Original body
Summary
Closes #21656.
What Changed
Fluxo
A mudança continua seguindo o fluxo original descrito na seção preservada abaixo, sem ampliar o escopo funcional deste PR.
Visão
A padronização melhora a revisão, reduz ruído e evita deriva de formatação entre PRs abertos.
Test Plan
Original body
What does this PR do?
Closes #21656.
Problem
Debian 13's apt-shipped
nodejspackage is 20.x. At least one transitiveweb/dep (language-tags@2.1.0) requires Node >= 22. npm only WARNs onengine mismatch, so the install completes but the resolver chain breaks
silently and the Vite build dies with a misleading
can't resolve clsxerror.
scripts/install.shalready pinsNODE_VERSION="22". The Dockerfilewas still installing Node from apt, so the container build drifted from
the host installer.
Fix
Dockerfilenow installs Node from NodeSource'ssetup_22.xscript(adds
gnupg+ca-certificatesto the base apt layer for the GPG keyfetch). No other layer touched.
Regression guards
tests/test_dockerfile_node_version.pyadds two pure-text guards (nodocker build, no subprocess):test_dockerfile_installs_node_from_nodesource_not_debian_apt— failsif any
apt-get installline co-installsnodejsandnpmwithout aNodeSource setup script in the same layer.
test_dockerfile_node_major_matches_installer— extractsNODE_VERSION="<major>"fromscripts/install.shand asserts theDockerfile contains
deb.nodesource.com/setup_<major>.x. Ifinstall.shbumps in the future and the Dockerfile lags, CI failsinstead of CI passing and the container build breaking on prod
deploys.
Verification
Stash-verified — both tests fail on baseline, pass with the fix:
Solution Sketch
Related Issue
Closes #21656.
Type of Change
Changes Made
.github/PULL_REQUEST_TEMPLATE.mdHow to Test
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Generated by Hermes Turbo
Generated by Hermes Turbo