Skip to content

NVM: Fallback to .tar.gz for darwin-arm64 binary when .tar.xz is 404 (e.g., Node 14.x) #3588

Open
@sayymeer

Description

@sayymeer

Operating system and version:

nvm debug output:

nvm --version: v0.40.3
$SHELL: /bin/zsh
$SHLVL: 1
whoami: 'user'
${HOME}: /Users/user
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v14.21.3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.9 (arm64-apple-darwin24.0)'
uname -a: 'Darwin 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041 arm64'
checksum binary: 'sha256sum'
OS version: macOS 15.5 24F74
awk: /usr/bin/awk, awk version 20200816
curl: /usr/bin/curl, curl 8.7.1 (x86_64-apple-darwin24.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.64.0
wget: not found
sed: /usr/bin/sed
cut: /usr/bin/cut
basename: /usr/bin/basename
rm: /bin/rm
mkdir: /bin/mkdir
xargs: /usr/bin/xargs
git: /usr/bin/git, git version 2.39.5 (Apple Git-154)
grep: /usr/bin/grep, grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
nvm current: v14.21.3
which node: ${NVM_DIR}/versions/node/v14.21.3/bin/node
which iojs: iojs not found
which npm: ${NVM_DIR}/versions/node/v14.21.3/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v14.21.3
npm root -g: ${NVM_DIR}/versions/node/v14.21.3/lib/node_modules

nvm ls output:

->     v14.21.3
       v18.20.8
         system
default -> lts/hydrogen (-> v18.20.8)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v18.20.8) (default)
stable -> 18.20 (-> v18.20.8) (default)
lts/* -> lts/jod (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.20.8
lts/iron -> v20.19.2 (-> N/A)
lts/jod -> v22.15.1 (-> N/A)

How did you install nvm?

Using brew

What steps did you perform?

  1. Attempted to install Node.js v14.x (specifically tried nvm install 14, nvm install 14.21.3, and nvm install 14.18.0) on an Apple Silicon (arm64) Mac.
  2. Observed NVM attempting to download a darwin-arm64.tar.xz binary.

What happened?

For certain Node.js v14.x versions (e.g., v14.18.0), NVM tried to download a darwin-arm64.tar.xz binary from https://nodejs.org/dist/. This resulted in a curl: (56) The requested URL returned error: 404 because the .tar.xz version of the darwin-arm64 binary does not exist for that specific Node version.
However, a darwin-arm64.tar.gz binary does exist on the server for that same Node version (e.g., https://nodejs.org/dist/v14.18.0/node-v14.18.0-darwin-arm64.tar.gz).
Because the .tar.xz download failed, NVM fell back to compiling from source. This fallback can also fail due to other incompatibilities (e.g., modern Python versions, newer Clang compiler issues with old Node 14 source), which could be avoided if the available .tar.gz binary was used.

What did you expect to happen?

I expected NVM to successfully download and install a pre-compiled darwin-arm64 binary for Node.js v14.x if one was available on nodejs.org/dist/.
Specifically, if NVM fails to find a .tar.xz binary but a .tar.gz binary exists for the target version and architecture (darwin-arm64 in this case), NVM should ideally attempt to download and use the .tar.gz archive before falling back to source compilation.

I successfully got it working by manually downloading the .tar.gz Node.js archive. After unarchiving it, I placed the contents into the correct NVM versions folder, and it's now operational.

Additional context / willingness to contribute:

I've manually verified that for versions like Node v14.18.0, the darwin-arm64.tar.gz binary is available on nodejs.org/. This forces an unnecessary (and often problematic for older Node versions on modern macOS) fallback to source compilation.

I am interested in exploring how to contribute a fix for this, perhaps by adding logic to check for and use the .tar.gz archive if the .tar.xz attempt results in a 404 for these specific darwin-arm64 cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pull request wantedThis is a great way to contribute! Help us out :-D

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions