An alternative for tricky Node.js installations
Ever had a super difficult time getting a Node version to install? Especially on an Apple Silicon-powered device?
I use asdf
with the node plugin and couldn't get a few older versions of Node to install.
For example:
asdf install nodejs 13.9.0
The failed install angered me further when I realized that installing with NVM did not have this issue.
While this knowledge angered me, I had no intention of utilizing two version managers. That's when I noticed that asdf
tries to install the node version with node-build
while nvm
downloaded a version from nodejs.org.
So I looked at the NVM version, and the folder structure looked the same as I was used to seeing in asdf
's installed folder (~/.asdf/installs/nodejs
), which gave me an idea.
What would happen if I just placed the contents where asdf
would expect them to be? It works!
You can 'url hack' your way to the version you need via https://nodejs.org/dist/v{VERSION_NUMBER}/
. That URL will take you to a listing of all the compiled entries for that Node version.
Being on an M1, I chose the Darwin compiled entry, node-v13.9.0-darwin-x64.tar.gz
.
Just uncompress the file and place it inside the folder asdf expects installs to be, like so: ~/.asdf/installs/nodejs/13.9.0
After that, I saw that the new Node version was already available and ready for use.
If you are having difficulties installing a particular NodeJS version, this method could save you considerable time.