Asdf is a version manager for everything: Ruby, Elixir, Erlang, Node.js, and so on. It is the preferred version manager for projects that aren't using Docker.
Install asdf via git into ~/.asdf
.
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
Add it to bashrc. (If you're on zsh, add it to ~/.zshrc
. For fish shell and others, see asdf setup docs).
# bash / Ubuntu
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
# bash / OSX
echo '. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
# Zsh
echo '. $HOME/.asdf/asdf.sh' >> ~/.zshrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
For Ubuntu and other Debian-based distributions, install dirmngr
. This is required to add NodeJS GPG keys.
sudo apt-get install dirmngr
Add asdf-vm plugins for Erlang, Elixir and Node.js, and anything else you may need.
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring