Last updated on February 27, 2021
In this blog post, you will be going to learn how to manage multiple node.js versions within the same OS (Windows, Mac, and Linux).
Nodejs.org released LTS for version 14.15.4 which includes npm version 6.14.10
Being a web developer, we used to come across a situation where we will have to manage multiple projects each having a different node version. We don’t really want to end up doing uninstall and install a required node version which complicates the developer’s life.
We will check out here what to do in order to resolve the above use case.
How To Manage Multiple Node Versions?
If you’re a Windows user, use Nodist software
If you’re a Mac/Linux user, use NVM (Node Version Manager)
But before doing the above step, please be aware that we should uninstall the existing Node.js
from our PC.
Node Version Manager (NVM/Nodist)
Once installed either NVM/Nodist software, You can well use the below commands for handy reference.
<Working-Directory>: nodist --help
will give you the list of available commands.
<WID>: nodist
will list all the installed node versions globally.<WID>: nodist local 'node_version'
will set the node version at the directory/folder level (This is mostly useful).<WID>: nodist global 'node_version'
will set the node version for the global level.<WID>: nodist npm latest/match
will install the required npm version against the node version.
Since I am a windows user, so here I have givennodist
based commands whereasnvm
will also share the same list of commands.