ProTip™: Installing Legacy Node Versions on Apple Silicon

Published

tl;dr arch -x86_64 /usr/bin/env bash.

I recently onboarded on to a new project and the hardest part of setting up my local environment was installing the correct Node version.

Sigh…

Normally, this is a breeze with nvm. I’ve even written about it, that’s how much I love it. However, this project is on a Node 14 which is 1) long since deprecated and 2) not natively supported by the ARM architecture on Apple silicon computers. I was also chasing a red herring the first time trying to debug some ultimately unrelated error messages around local Python versions when my computer was attempting to build Node from source.

From that issue I was able to find myself on this StackOverflow which led me to softwareupdate --install-rosetta (which I’ve already done as it’s essentially part of bootstrapping any new Mac computer in the last couple of years) followed by a new-to-me command: arch -x86_64 zsh.

However, I don’t use the default zsh, but rather bash, so I modified it:

arch -x86_64 /usr/bin/env bash

After running this command once in this modified shell session, I was able to back out via Ctrl + D and use Node 14 in any shell session.

And yes, upgrading Node versions is on the backlog shortlist.


I love hearing from readers so please feel free to reach out.

Reply via emailSubscribe via RSS or email

Last modified  #protip   #dx   #programming   #js 


← Newer post  •  Older post →