Skip to content

[Fix] support arm64-musl on Alpine Linux#3845

Open
ITJesse wants to merge 1 commit into
nvm-sh:masterfrom
ITJesse:fix/alpine-arm64-musl
Open

[Fix] support arm64-musl on Alpine Linux#3845
ITJesse wants to merge 1 commit into
nvm-sh:masterfrom
ITJesse:fix/alpine-arm64-musl

Conversation

@ITJesse
Copy link
Copy Markdown

@ITJesse ITJesse commented May 22, 2026

Summary

On Alpine Linux, nvm_get_arch only maps x64x64-musl, leaving arm64 unchanged. As a result, nvm install on Alpine aarch64 (e.g. Alpine on Raspberry Pi, AWS Graviton, Apple Silicon containers, iSH) tries to download the glibc-linked linux-arm64 tarball, which fails to run against musl libc.

Node.js unofficial-builds publishes linux-arm64-musl binaries starting from v20.20.1 / v22.21.1 / v24.0.0+. This change maps NVM_ARCH=arm64 to arm64-musl on Alpine so the correct tarball is resolved.

Example URL that now resolves correctly:

Test plan

  • On Alpine aarch64, verify nvm_get_arch returns arm64-musl
  • NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release nvm install 24.9.0 downloads node-v24.9.0-linux-arm64-musl.tar.gz successfully
  • On Alpine x64, nvm_get_arch still returns x64-musl (unchanged behavior)
  • On non-Alpine arm64 (regular glibc Linux), nvm_get_arch still returns arm64 (unchanged behavior)

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.
@ljharb
Copy link
Copy Markdown
Member

ljharb commented May 23, 2026

What happens on that arch when you run nvm install 24.9.0 without the mirror env var?

@ITJesse
Copy link
Copy Markdown
Author

ITJesse commented May 23, 2026

Without the mirror env var, nvm install 24.9.0 first tries to download:

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants