How to Install NVM to Manage Node Versions Easily

Written by smpnjn | Published 2022/08/08
Tech Story Tags: web-development | nodejs | javascript-development | javascript | javascript-tutorial | javascript-fundamentals | website-development | software-development

TLDR'nvm' is used to manage the versions of Node.js installed on your computer. Using it, you can upgrade and change which version you're running. If you want to install a different version of `nvm` you can replace the `v0.39.1` with whatever version you'd like to use. Alternatively, you need to use `wget` to install nvm` on Linux or Mac. Using nvm on Windows you'll need to install an 'nv-windows' package like nvm-windows.via the TL;DR App

nvm stands for Node Version Management. If you don't have it installed already, in this quick guide we'll show you how to. nvm is used to manage the versions of Node.js installed on your computer, so it's a really useful tool. Using it, you can upgrade and change which version of Node.js you're running on your computer, and change Node.js version.

How to install nvm

On Linux or Mac, to install nvm, you can use the curl command:

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

If you want to install a different version of nvm, you can replace the v0.39.1 with whatever version you'd like to use. Alternatively, you can use wget to install nvm:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

After running one of these commands, you need to add nvm to your bash profile. So run this command next, so that you can get started using it immediately:

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

How to install nvm on Windows

As with most things, windows is a little different. If you want to use an nvm-like functionality on windows, you'll need to use a package like nvm-windows. You can learn more about nvm-windows here, and for the latest install instructions, check out this link.

Conclusion

I hope you've enjoyed this quick guide. If you want to connect with me, I'm on Twitter and LinkedIn.


Also published here.


Written by smpnjn | Product, Engineering, Web
Published by HackerNoon on 2022/08/08