fix(ci): give the musl build a Node the napi CLI can run - #626
Merged
Conversation
The image bundles Node 18; @napi-rs/cli v3 imports styleText from node:util, which needs 20. Its apk points at edge, whose Node will not relocate against the older base.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthroughThe musl Node native-addon build now uses a repository script for Alpine setup, toolchain selection, dependency installation, and compilation. The publish workflow invokes this script inside the configured Docker image. ChangesMusl native addon build
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
kartikeya-27
approved these changes
Aug 3, 2026
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.
Build aarch64-unknown-linux-muslfailed on thenode-v0.22.0publish run:ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpinebundles Node 18.20.5 on an Alpine 3.20 base.@napi-rs/cliv3 pulls@inquirer/corev11, which importsstyleTextfromnode:util—added in Node 20. The workflow already prints the warning right above the crash:
Unsupported engine: wanted {"node":">=20"} (current v18.20.5). This surfaced with the napi2 → 3 upgrade (#581) and only on musl, since that is the one target built inside the image.
The image's
/etc/apk/repositoriespoints at edge, soapk add nodejsthere installs Node24 built against a newer libc/openssl and it fails to relocate:
Repointing apk at the image's own Alpine release gives Node 20.15.1, ABI-consistent with the
base. The branch is read from
/etc/alpine-releaserather than hardcoded, so a rebased imagestays consistent instead of silently pulling mismatched packages.
Extracted the container steps to a script
The step had grown into a quoted shell blob inside YAML. It now lives in
.github/scripts/build-node-native-musl.sh, which is shellcheck-clean and runnable locallyagainst the same image — the only way this path gets exercised, since no PR job builds musl.
Two other things fell out of the move:
packageManagerinstead of being a second copy of10.33.0thatcould drift from
sdks/node/package.json.apt-getbranch is gone. Only the two musl entries setdocker:, and both are Alpine.Verification
Ran the committed script in
ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpineagainst a cleangit archiveof the tree, skipping only the long Rust build:That last command is the one that raised the SyntaxError. Confirmed the causality both ways in
the image: under the bundled Node 18 the same
napi --versionreproduces the crash exactly;under 20.15.1 it prints the version.
shellcheckclean,sh -nclean, workflow YAML parses.Follow-up
node-v0.22.0already points at913d5331, which predates this. Once merged, re-runPublish to npm via
workflow_dispatchonmasterwith version0.22.0— preflightvalidates against
scripts/version.mjs --current, which is0.22.0there, so no re-tag isneeded.
Summary by CodeRabbit