This article will go through basic asdf configuration for Node.js, including how asdf can read from existing .nvmrc files.
asdf supports multiple langauges. This allows me to learn one version manager for all of them. Every languages has their own preferred language manager, and they all vary slightly. Learning a single version manager and its commands just makes sense
asdf automatically changes node version based upon a directory’s
.nvmrc (with configuration). Though this can be done with nvm in conjuction with some additional bash scripting. I found the solution rather cumbersome, and the actual usage introduces quite a bit of latency when changing into a directory and the script running
nvm use in the background.
With asdf, this all goes away, and it just works and is instant.
Install using homebrew
brew install asdf
asdf plugin add nodejs
To view all available versions using this command
asdf list all nodejs
Choose a specific version or use the
asdf install nodejs latest asdf global nodejs latest
echo 'legacy_version_file = yes' > ~/.asdfrc
yarn config set prefix ~/.yarn
This will let yarn know where to find global packages that were installed with asdf.
Completions can be installed using this plugin.
There is also an oh-my-zsh plugin available.