jorgebucaran / nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
https://git.io/nvm.fish
MIT License
2.08k stars 69 forks source link

Apple Silicon and URL string generation #138

Closed jamesb93 closed 3 years ago

jamesb93 commented 3 years ago

Hi there,

Currently there are no Darwin arm64 builds of node on the official nodejs website. This causes the string formation to fail.

A quick solution is to change lines https://github.com/jorgebucaran/nvm.fish/blob/476a9e63d9bfb07971469462c62cbd77fb6997d4/functions/nvm.fish#L63 to:

case x86_64 arm64
    set arch x64

This may cause some unforeseen issues, for example you can get arm64 builds for Linux in which case that combination would need to be tested for as well.

Anyway this may be worth an official fix.

jorgebucaran commented 3 years ago

I don't have an M1 Mac to test this. Do you want to send me PR?

jamesb93 commented 3 years ago

No problem, I can do that later. Does changing this line affect Linux users though who would want the arm64 binaries if thats their arch?

jorgebucaran commented 3 years ago

I think we should just abort with an error until builds are available.

jamesb93 commented 3 years ago

Hmm okay. If I made a PR that warns the user but goes ahead accordingly and doesn't mess with Linux would that be acceptable?

jorgebucaran commented 3 years ago

Do arm64 builds work fine on the M1 chip? I think they don't, no? hence my desire to abort.

What problem did you face exactly, and what did you expect to happen? Thank you!

jamesb93 commented 3 years ago

It's not about whether or not the builds work - its the fact that there simply are none.

https://nodejs.org/dist/latest/ has only Darwin x64 builds. You can use these without issue on Apple Silicon, its just that nvm.fish is currently looking for a binary download that doesn't exist.

jorgebucaran commented 3 years ago

We should not fail, and install the ones that work then. Make sense?

There's a contradiction in what you said, though:

its the fact that there simply are none

[...] has only Darwin x64 builds. You can use these without issue on Apple Silicon

So, there are no builds, but they work? Which one is it? 😂

ljharb commented 3 years ago

There are no M1 builds. There are Rosetta emulated builds which “work” but not truly natively. In other words, it’s not a binary choice, so there does not exist a simple answer to your question.

jorgebucaran commented 3 years ago

Got it. We can download the darwin x64 builds or abort with an error message. What do you think?

jamesb93 commented 3 years ago

Hey! Sorry, i've been quite overwhelmed. If I get to this it won't be for a little while.

raulrpearson commented 3 years ago

I'm setting up my new M1 and ran into this problem. @jamesb93's solution worked for me. I'm happy to open a PR but, since it'd only be a temporary fix (until nodejs.org offers builds or until #142 is merged, assuming that works for M1), would you still want to go ahead with it?

jorgebucaran commented 3 years ago

It may be a while before #142 is merged. Sure, send me a PR and we can continue the discussion in there. 🙏