[ci] Install Node.js from the official tarball in the native-builder image - #96298
Merged
Conversation
The native-builder image installed Node.js 20 through the NodeSource setup script, which downloads and imports a signing key before configuring the apt repository. When that key download returned an HTTP 403 from CI runners the script still exited successfully, so apt fell back to Ubuntu's stock nodejs package. That package does not bundle npm, which broke later steps that run npm inside the image (for example installing @napi-rs/cli), failing the build_and_deploy native build. This change installs Node.js 20 from the official nodejs.org static tarball instead. The tarball bundles npm and corepack, is glibc-linked to match the previous setup, and does not depend on NodeSource's apt repository or key server, removing the flaky external dependency. The install step also asserts npm --version so a future regression fails at the install layer rather than several layers later.
Contributor
Tests PassedCommit: 6bf31d1 |
Contributor
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URLCommit: 6bf31d1 |
eps1lon
marked this pull request as ready for review
July 28, 2026 17:25
bgw
approved these changes
Jul 28, 2026
bgw
left a comment
Member
There was a problem hiding this comment.
Seems likely to be a bit faster and more robust. Thanks!
Comment on lines
+71
to
+72
| curl -fsSLo /tmp/node.tar.xz \ | ||
| "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" && \ |
Member
There was a problem hiding this comment.
-
There's a retry flag you can use with curl:
next.js/.github/workflows/build_reusable.yml
Line 224 in 925edc3
-
Prefer long-form arguments for scripts, single letter arguments are indecipherable.
Comment on lines
+73
to
+74
| tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \ | ||
| --exclude CHANGELOG.md --exclude LICENSE --exclude README.md && \ |
Member
There was a problem hiding this comment.
It's slightly cleaner to put this in a node-specific path (usually under /opt for this sort of stuff) and then to just modify the PATH (we already do this below for /root/.cargo/bin)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes e.g. https://github.com/vercel/next.js/actions/runs/30314671467/job/90137708228#step:12:603
The
native-builderimage (scripts/native-builder.Dockerfile), used by thebuild-nativejob ofbuild_and_deploy.ymlto cross-compilenext-swc, installed Node.js 20 via the NodeSource setup script. That script downloads and imports a signing key before configuring the apt repository. When the key download returns an HTTP 403 from CI runners the script still exits successfully, soapt-get install nodejsfalls back to Ubuntu's stocknodejspackage, which does not bundlenpm. The failure only surfaced two layers later when the image rannpm i -g @napi-rs/cli(npm: not found, exit 127), breaking the native build.This change installs Node.js 20 from the official
nodejs.orgstatic tarball instead. The tarball bundlesnpmandcorepack, is glibc-linked (matching the previous intent), and does not depend on NodeSource's apt repository or key server, removing the flaky external dependency. The install step also assertsnpm --version, so a future regression fails at the install layer rather than several layers later.test plan