[Fix] support arm64-musl on Alpine Linux#3845
Open
ITJesse wants to merge 1 commit into
Open
Conversation
Node.js unofficial-builds publishes linux-arm64-musl binaries since v20.20.1 / v22.21.1 / v24+. Map NVM_ARCH=arm64 to arm64-musl on Alpine so `nvm install` resolves to the correct tarball instead of the glibc-linked arm64 build that won't run against musl.
Member
|
What happens on that arch when you run |
Author
|
Without the mirror env var, https://nodejs.org/dist/v24.9.0/node-v24.9.0-linux-x64-musl.tar.gz That URL returns 404, so the binary download fails. Then nvm falls back to building from source, downloads: https://nodejs.org/dist/v24.9.0/node-v24.9.0.tar.gz and the checksum passes successfully. Full output: nvm install 24.9.0
Downloading and installing node v24.9.0...
Downloading https://nodejs.org/dist/v24.9.0/node-v24.9.0-linux-x64-musl.tar.gz...
curl: (22) The requested URL returned error: 404
download from https://nodejs.org/dist/v24.9.0/node-v24.9.0-linux-x64-musl.tar.gz failed
grep: /root/.nvm/.cache/bin/node-v24.9.0-linux-x64-musl/node-v24.9.0-linux-x64-musl.tar.gz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 9 CPU core(s)
Running with 8 threads to speed up the build
Downloading https://nodejs.org/dist/v24.9.0/node-v24.9.0.tar.gz...
################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched! |
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.
Summary
On Alpine Linux,
nvm_get_archonly mapsx64→x64-musl, leavingarm64unchanged. As a result,nvm installon Alpine aarch64 (e.g. Alpine on Raspberry Pi, AWS Graviton, Apple Silicon containers, iSH) tries to download the glibc-linkedlinux-arm64tarball, which fails to run against musl libc.Node.js unofficial-builds publishes
linux-arm64-muslbinaries starting fromv20.20.1/v22.21.1/v24.0.0+. This change mapsNVM_ARCH=arm64toarm64-muslon Alpine so the correct tarball is resolved.Example URL that now resolves correctly:
Test plan
nvm_get_archreturnsarm64-muslNVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release nvm install 24.9.0downloadsnode-v24.9.0-linux-arm64-musl.tar.gzsuccessfullynvm_get_archstill returnsx64-musl(unchanged behavior)nvm_get_archstill returnsarm64(unchanged behavior)