Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I need to uninstall node from my computer to use nvm?

Tags:

I recently decided to install nvm, and the instructions had me uninstall node. I noticed that if I explicitly tell nvm to use a certain version it uses it from the nvm directory, otherwise it uses my bin/node directory, so I didn't notice a conflict. When I uninstalled node, i needed to specify a version every time I use my terminal which seems like an unnecessary step when I could just leave node installed via brew and use nvm if I need to version control.

like image 271
Michael Belsito Avatar asked Feb 02 '20 19:02

Michael Belsito


1 Answers

Once you install nvm and use Node through it, it does NOT use bin/node, but the version installed with nvm, so your old Node is obsolete.

The main reason they recommend you to uninstall Node is because it could confuse the shell about which Node to use. Of course, you can update your shell config so that it first looks for Node installed from nvm, but that's an unnecessary extra step and your old Node distribution is obsolete on your disk, at best.

So, the best solution is uninstalling the old distribution and install nvm (which by default installs the latest Node in your .nvm folder), and install more versions of Node if necessary.

And regarding this:

i needed to specify a version every time I use my terminal which seems like an unnecessary step

You don't need to, as long as you set the default version (say, 11.15.0) config after installing nvm with the following command:

nvm alias default 11.15.0
like image 87
technophyle Avatar answered Sep 21 '22 22:09

technophyle