In this tutorial, you will learn about NVM and how you can use it to install Node.js. NVM stands for Node version manager. You can use NVM to install Node. If you are starting off with Node then simply install it on your computer will do. When you work in a large company and you have multiple projects to work on, things become trickier.
Like all good programming languages, node release updates every once in a while. With each new update of node comes new features, syntax improvements etc.. if you write a script in Node 10 using some new feature, then it might not run in Node 8. At work, if you have two apps, one that only works on Node 10, one that works on Node 8, what do you do? Constantly, uninstalling and re-installing Node is a pain...this is where NVM comes into play. NVM is an essential tool to know about because of out-of-the-box Node will just install itself.
How To Install NVM
After installing homebrew, close and open your terminal, then type:
Next, type in:
Next, you will likely need to create and configure a bash profile and create an alias for NVM. You can do this within the terminal, by typing:
In here, if you do not see anything related to NVM then add in this snippet:
Save the file (CTRL + O) then (CTRL + X). Close and re-open the terminal. type,now type:
If everything has gone according to plan it should load OK.
How To Install NPM with NVM
Now you have NVM installed, we can install Node. To install Node you can type:
Use the latest version with:
To install the latest version: