nvm
or “Node.js Version Manager” works at the level of an independent directory within your home directory. This means that you can install multiple self-contained versions of Node.js without affecting the whole system.
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh -o install_nvm.sh
Run the script with bash
:
To gain access to the nvm
functionality, you’ll need to either log out and log back in again or source the ~/.profile
file so that your current session knows about the changes:
source ~/.profile
Some nvm commands to go through
nvm ls-remote
nvm install 12.9.0
nvm use 12.9.0
node -v