Become into a warrior of codeNavigate back to the homepage

How to install Nodejs in the right way using NVM

Ulises Castro
September 11th, 2020 · 1 min read

A long time ago, I installed Nodejs using the official installer. However, I was facing several issues and I can bet you that even you have faced issues once you have installed Nodejs with the official installer.

But whats wrong using the official installer?

Well, the problem could emerge when:

  • You have several projects and they have to be run at a certain version of Node
  • You want it to use a newer/older version.

So, what we have to do?

Install NVM (Node Version Manager), which allows us to install and use any version of Node, isolating installed noder versions on your computer, so that, we can install different packages per installed version,

First of all

You have to install on your system git, curl, or wget to download nvm.

If you are using a distro based on Arch Linux

sudo pacman -S git wget

or using Yay

yay -S git wget

Ubuntu

sudo apt install git wget

Note: If you using Linux, you have to refresh your Bash profile, to do that, just type on a terminal:

source ~/bashrc

If you are using Oh my Zsh

zsh

Windows (I don’t recommend use windows for development to be honest).

Windows has several issues, but it has its own version.

https://github.com/coreybutler/nvm-windows

I recommend switch to Linux. At least to use the Ubuntu terminal on Windows could save you a lot of time on incompatibilities concerns.

First Steps using NVM.

We suppose, we want to install version 12.18.3.

Just type the following command on your terminal

nvm install 12.18.3

If you want use it

nvm use 12.18.3

What If want to use it as my default node version?

nvm default 12.18.3

Conclusion

We learn how to manage our Nodejs versions using NVM, so we can switch them easily from version 12 to 8 and vice-versa.

Join our email list and get notified about new content

Be the first to receive our latest content with the ability to opt-out at anytime. We promise to not spam your inbox or share your email with any third parties.

© 2020 WarriorCode
Link to $https://twitter.com/ulisescastro_Link to $https://github.com/ulises-castroLink to $https://facebook.com/warriorcode.net