Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
NVM is a multiplatform tool for installing Node. Once it's installed on a Mac, switching between versions is easy. Let's install NVM now and then use it to install Node. I'm at the homepage for NVM on Github. Down in the install script section, it says it requires Git. I already have Git installed on this computer. But if you don't, you can watch Git Essential Training. Specifically watch the Installing Git on a Mac video. Installation also requires a C++ compiler.
If you don't already have the C++ compiler installed, watch Xcode 4 Essential Training, specifically the Installing Xcode video. Make sure you get the command line tools. Now let's install NVM. I'm going to copy the install script. And then I'm going to go to terminal. I'm going to paste that command in. This command is going to download the install script from GitHub and then run it. It's now telling me to close and reopen my terminal to start using NVM. So I'm going to do that. I'm going to close terminal entirely. And now I'm going to re-open it.
So now let's type nvm. Now we can use nvm to install Node. To do that type nvm install, and then type the version number of Node that you want to install. In this case, I'm going to install 0.10. And, you don't have to add the final segment there, it will automatically install the latest in that series if you just omit it. Now, I'm going to press return. So, it's telling me that I'm now using node version 0.10.18. Now, if I type node, it pulls up a command prompt.
I'm going to press ctrl + c and I'm going to press it again to get out. And now before I close this terminal window, I want to make sure that nvm always uses this version of Node. So to do that, I'm going to type nvm alias then default And then, 0.10. So now I'm going to close out this window and I'm going to open Terminal again, and I'm just going to type node. So node is still available. And if I do node --version it's going to show node v0.10.18 Now let's say I wanted to use node 0.8 to test something very quickly. To do that I can use nvm again, so I'm going to type nvm install and then 0.8.
So now it's telling me I'm using node 0.8.25. And if I do node then -- version, it's going to show that version instead. And I can pop into the node terminal. And then I can press Ctrl+c and again to quit. And I'm back to my command prompt. So let's see what happens when I close out Terminal and open it again. If I type in node and then --version, it's gone back to 0.10.18. So let's say I wanted to use version 0.8 again.
To do that I'm going to type nvm use 0.8. I use the use command this time because I've already installed 0.8. And, then if I want to switch back to 10, I can type nvm use and then 0.10. 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 a compiler and get are available, nvm can be installed with one line of commands.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 104725 Viewers
56 Video lessons · 116614 Viewers
71 Video lessons · 85802 Viewers
131 Video lessons · 41053 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.