Let’s start with a simple question “how would you manage multiple version of Node.js on a single machine”, you may come across with various options, either is great
Not long after, the latest stable version of Node.js is released, along with all the promised improvements, you’ll have projects to upgrade
In
n
In
nvm
n lts n
nvm install --lts nvm use --lts
Equally simple.
However, every once in a while, you’ll need to switch another project written in Ruby, potentially the backend of your Node.js project, then you’ll need to ask the very same question in the beginning of article for Ruby. This time you may come across with
How about using the latest stable version of Ruby then?
In
rbenv
In
rvm
rbenv install 3.0.2 rbenv use 3.0.2
rvm install --lts rvm use --lts
Here we start to see some issue. Not a surprise, the CLI (command line interface) for the Node and Ruby version managers are different, and discrepancies are hard to remember due to context switching.
Fallback to Google? Well, don’t repeat yourself.
But the CLI of
nvm
and rvm
looks similar to each other? Yes, until you need to work with a data science tool written in Python and look for something like pvm
while everyone else uses pyenv
. It’s clear that what we really want is a single CLI tool that manages different versions of different runtime (programming language) with a unified interface, and asdf exists exact for this reason.
asdf install <name> <version> asdf local <name> <version>
Give it a try! :D