Npm registry has a very powerful version manager for node js known as n.
#n – Interactively Manage Your Node.js Versions. By using n we can change the node js version by hitting a single command.
Firstly we need to install n globally in our machine.
npm install -g n
After installation, we can call n directly
n 10.16.0 // just pass the version you want to install
n lts // lts stands for long term support version
n current // by using current we can install latest version
As demonstrated in the above example we can install any version by n
You can execute n on its own to view your downloaded versions and install the selected version.
Use up/down arrow keys to select a version, enter key to install, d to delete, q to quit