Code With Wolf

NVM: Node Version Manager

NVM: Node Version Manager

I run across node/npm issues often. As I've written about in some other posts, using NVM and Windows Subsystem For Linux have solved a lot of my issues.

I wanted to talk about NVM, node version manager, here because I think it could benefit a lot of nodeJS developers.

What is NVM?

Node version manager allows you to manage multiple version of node on your machine.

You can read about it in the readme here.

Why use NVM?

I use NVM because I am contantly chasing down error messages on Stack Overflow. Often times I see an answer along the lines of

You are using node 11.13.1 and you need to upgrade to 11.13.2 or downgrade to 11.11.7. 

If you have multiple projects you are working on with node and can't always be messing with your machine's global version numbers, NVM is that solution.

Another great reason to use NVM is if your team is all running different version of node on their machines. You can use a .nvmrc file to tell the server which version of node to run. You and your team could use that version of node for that specific project, and then free up other projects to use another version of node or to try out the LTS.

How to get started with NVM on Windows

Pretty simple, install it globally on your machine.

Install the latest release, here.

Once you run through the setup wizard, you should have NVM.

Test it by checking the version number:

nvm -v.

You should see the version in your terminal.

How do I install new node versions with NVM?

After that, you can install your node versions by:

nvm install <NODE VERSION>

How do I know which node versions I have installed?

And you can see which node versions by listing them.

nvm ls

How do I switch between node versions

You can swhich between node versions by:

nvm use <NODE VERSION>

and then confirm it by checking the version:

node -v.

In Conclusion

NVM has been a very useful tool and gotten me out of some trouble with various versioning issues. Give it a try and let me know what you think!

© 2022 Code With Wolf