-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
NVM: Fallback to .tar.gz for darwin-arm64 binary when .tar.xz is 404 (e.g., Node 14.x) #3588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note that nvm installed with brew is unsupported (as the formula tells you); please remove it and install it using the official installation script. Additionally, node < 16 on ARM requires a rosetta terminal afaik - I'm not sure what the deal is with that node 14.18 binary. |
Can you please explain why is it so? Why it is unsupported (I am new to open source). --Update-- > nvm install 14
Downloading and installing node v14.21.3...
Downloading https://nodejs.org/dist/v14.21.3/node-v14.21.3-darwin-arm64.tar.xz...
curl: (56) The requested URL returned error: 404
download from https://nodejs.org/dist/v14.21.3/node-v14.21.3-darwin-arm64.tar.xz failed
grep: /Users/syadav27/.nvm/.cache/bin/node-v14.21.3-darwin-arm64/node-v14.21.3-darwin-arm64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 14 CPU core(s)
Running with 13 threads to speed up the build
Clang v3.5+ detected! CC or CXX not specified, will use Clang as C/C++ compiler!
Downloading https://nodejs.org/dist/v14.21.3/node-v14.21.3.tar.xz...
############################################################################################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched! And building from source get failed. |
Primarily because I don't distribute nvm there, which makes it unofficial, and software should only be installed from official distribution channels - but in the specific case of brew, the user experience is severely degraded, and i don't want my users to blame nvm for that. What happens if you follow the instructions in the readme for using a Rosetta terminal? |
I have followed the readme instruction (also using rosetta). |
Operating system and version:
nvm debug
output:nvm ls
output:How did you install
nvm
?Using
brew
What steps did you perform?
nvm install 14
,nvm install 14.21.3
, andnvm install 14.18.0
) on an Apple Silicon (arm64) Mac.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 fromhttps://nodejs.org/dist/
. This resulted in acurl: (56) The requested URL returned error: 404
because the.tar.xz
version of thedarwin-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
, thedarwin-arm64.tar.gz
binary is available onnodejs.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 specificdarwin-arm64
cases.The text was updated successfully, but these errors were encountered: