Skip to content
Related Articles

Related Articles

How to Run Multiple Versions of Node.js ?
  • Last Updated : 03 Dec, 2020

Usually, we work on different versions for our Node.js project and it’s hard to manage them, but fortunately, there is a tool called NVM(node version manager) which helps to manage your node version and switch between them according to your projects.

Install NVM Module:

You can install the nvm module using the following command:

Using curl:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/v0.34.0/install.sh | bash

After installation, you need to add a bit of configuration in your .bashrc file as shown below:



$ nano ~/.bashrc

Then add the following code to the end of the file: 

export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
[ -s :$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Reload your bash using the following command:

$ source ~/.bashrc 

Module Installation: To install the latest version of Node, the following command can be used:

$ nvm install node

To install the specific version of Node, the following command can be used:

$ nvm install {node_verion}
$ nvm install 10.10.0

List all Node Version: To list out all the versions installed, the following command can be used:

$ nvm ls

Switch Node Version: The switching between different node versions can be done using the following command:

$ nvm use node  # to use latest version
$ nvm use 10.0.0  # for a specific verion

Deleting Node versions: The node versions can be uninstalled using the following command:

$ nvm uninstall 10.0.0

Conclusion: Managing the node versions is very useful if you are working on multiple projects which requires a different version of node. Above given are some important commands for doing so.

Reference: 

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :