In order to have multiple versions of NodeJS installed. For example, because you have a VPS that runs an outdated version of NodeJS. Then you can easily fix this without modifying the system or messing with the package manager. Using the Node Version Manager (nvm) script, you can easily install and use different versions of NodeJS.

Portable installation:

cd ~ git clone https://github.com/nvm-sh/nvm.git .nvm cd .nvm git checkout v0.39.3

Usage:

source ~/.nvm/nvm.sh # install a specific version, or --lts for the latest LTS version nvm install --lts # use a specific version nvm use --lts # check to see it really changed node -v # switch back to system installed nvm use system # check to see it really changed back node -v

More complete list of useful examples:

Example: nvm install 8.0.0 Install a specific version number nvm use 8.0 Use the latest available 8.0.x release nvm run 6.10.3 app.js Run app.js using node 6.10.3 nvm exec 4.8.3 node app.js Run `node app.js` with the PATH pointing to node 4.8.3 nvm alias default 8.1.0 Set default node version on a shell nvm alias default node Always default to the latest available node version on a shell nvm install node Install the latest available version nvm use node Use the latest version nvm install --lts Install the latest LTS version nvm use --lts Use the latest LTS version