How to change node version using nvm ?

How to change node version using nvm ?

This tutorial guides you on how to change node version using nvm. If you wanted to switch between Node setups or versions then you are at the right place.

How to change node version using nvm ?

How to change node version using nvm ?

Let’s say you are working on couple of Node projects and had installed multiple versions of Node setup on your machine. And you wanted to switch between Node versions based on the project that you wanted to run. It is possible and easy to change node version using nvm.

nvm” stands for Node Version Manager. As the name suggests, you will be able to manage switching between different node versions easily using nvm.

First, check what is the default nvm and node version set on your machine by running the following commands.

To check nvm version.

$ nvm -v

0.38.0

And for checking node version.

$ node -v

v6.14.4

Check node versions installed and available

To check node versions that you had installed, you need to run nvm list or nvm ls command as shown below

$ nvm list

->      v6.14.4
       v14.16.0
default -> v6.14.4
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v14.16.0) (default)
stable -> 14.16 (-> v14.16.0) (default)
lts/* -> lts/fermium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.3 (-> N/A)
lts/fermium -> v14.17.3 (-> N/A)

From the above response, it is understood that there are two versions of Node installed on your machine (v6.14.4 & v14.16.0). And in that the v6.14.4 has been set as default. And let’s say you wanted to switch from v6.14.4 to v.14.16.0.

All you need to do is just run the following nvm use command to change the node version using nvm.

$ nvm use v14.16.0

Now using node v14.16.0 (npm v6.14.11)

Therefore, from the response above you could see that now your machine is using node v14.16.0.

Also, you can verify whether node version is changed by running the following command.

$ node -v

v14.16.0

That’s it. You had learnt how to change node versions using nvm.

Hope it is helpful 🙂

Also see:

References:

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments