Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
NVM is a multi-platform tool, for installing Node. Since NodeJS.org does not offer pre-compiled binaries for Linux, NVM provides a more convenient alternative, to compiling Node, manually. Let's install NVM now and then use it to install Node. I'm at the NVM homepage on GitHub and I'm scrolling down, to the installation section. It's saying, we're going to need to have Git and cURL installed, in order to install NVM. So lets go to terminal and install these two commands now.
To install Git, I'm going to type sudo apt-git and then, install git. If it prompts you to install any dependencies, just say yes to install them. And now I'm going to do the same for cURL. I'm pressing the up arrow on my keyboard, and now I'm just replacing Git with cURL. So now I have Git and cURL, installed on this computer. So now with those two commands ready to go, I'm going to copy the install command and paste it in. So I'm going to go back to Firefox and I'm going to copy this entire line, and then I'm going to go back to terminal, and paste it in.
So now at the bottom of the screen, it's saying close and reopen your terminal, to start using NVM. It's also saying that, it appended the source string to home/josephleblanc/.profile. Now typically, this would work, I'd be able to log out of terminal and log back in and NVM would be ready to go. However, the code that it added. profile on this particular version of Ubuntu, is never executing, when I re-open terminal. So what I'm going to need to do is, copy that code from the bottom of. profile and move it to. bashrc .
So to do that, I'm going to type in more, space,. profile, and then I'm going to press Return, and then I'm going to copy this final line and I'm going to paste it into bashrc. I'm going to use the Pico text editor, to edit bashrc. So I'm going to type pico, space and then. bashrc . So I'm going to go all the way to the end of the file, and then just paste that command in. Now I'm going to press Ctrl+O to write out and to save. And now I'm also going to press Ctrl+X, to get out of Pico.
So now that command has been added to bashrc. Now I'm going to close out Terminal and reopen it. So now I'm going to type NVM. So NVM has been installed and it's ready to go. Now that I have NVM, I'm going to install Node, through NVM. So to do that, I'm going to type NVM, space, install, and now I'm going to specify the version number of Node, that I want to install. In this case, I want to install 0.10, and you don't have to specify the latest patch number, NVM's going to automatically pull the very latest.
So in the last line here, it says we're now using Node version 0.10.18. If I type in Node, it's going to pull up the interpreter, and if I press Ctrl+C two times, it brings me back to the command prompt. I can also switch versions of Node. To do that, let's install another version of Node. I'm going to install version 0.8. So I'm going to type NVM, space, install, and 0.8. So now I'm using Node version 0.8.25. If I do Node, space, dash, dash version, it shows that I'm using 0.8.
If I want to go back to version 0.10, all I have to do, is type NVM use 0.10. Now, one thing to do before I close out this terminal window, is I want to set version 0.10 as my default version. If you don't set a default version, each time you open up the terminal window, you're not going to have Node. So to do that, I'm going to type NVM and then alias, and then I'm going to type default and then finally, 0.10.
So this has now set the default version of Node to 0.10, so I can close this terminal window and then, open up a new one, I can type in Node and then dash, dash version, and it'll show that it's running version 0.10.18. Now, there's another thing to note about Linux. Your distribution may have a way of installing Node through the operating system's package manager. While this is generally a faster way of getting Node installed on Linux, you're only able to install the version supported by the package manager.
I personally prefer to use NVM, so I can always specify the exact version, I want to use. This way, I don't have to wait for the operating system vendor to update their packages, when an update comes out. NVM gives you the flexibility of selecting the exact version of Node you want to use, as well as the ability to easily switch versions. After making sure cURL and Git are available, NVM can be installed, with one line of commands.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 102013 Viewers
61 Video lessons · 88729 Viewers
71 Video lessons · 72554 Viewers
56 Video lessons · 104194 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.