- Overview
- Transcript
2.3 Installing Node.js Using NVM
To run a Node.js app, you obviously need Node.js! To install it in a maintainable way, it’s best to use a version manager. We will use NVM to install the latest Node.js version and all its dependencies.
Related Links
1.Introduction3 lessons, 06:03
1.1Introduction01:16
1.2Installing VirtualBox and Vagrant02:05
1.3Advanced Setup: Vagrant and VMware02:42
2.Setting Up Your Node.js Stack6 lessons, 23:57
2.1Project Overview05:05
2.2The Vagrantfile05:02
2.3Installing Node.js Using NVM02:50
2.4Installing MongoDB and Redis05:43
2.5Node.js Development Workflow02:42
2.6Autostart the Node.js Application02:35
3.Exporting and Sharing2 lessons, 09:16
3.1Exporting and Sharing Your Vagrant Box07:28
3.2Sharing Your Local Vagrant Instance01:48
4.Conclusion1 lesson, 00:54
4.1Final Review00:54
2.3 Installing Node.js Using NVM
Hi and welcome back to easy notechest environment of Vagrant. In this lesson we will be installing notechest using the VMV version manager. First, start your Vagrant box with Vagrant up and SSH entered Vagrant SSH. The installation instructions for NVM are written in the readme file of the project's GitHub repository. You can find the link down below. They offer an install script and ready to paste commands for either curl or wget. I'm going to use the latter one since our base box is so minimal, it doesn't even have curl installed. Go back to you cell, paste the command, and execute it. This will install NVM for a current user and put the necessary initialization commands in your shares configuration files. After installation is complete, we can either exit and restart or save session, or use the source command to reinitialize it. After doing that, NVM is ready to use. We can try it out by typing NVM and it should show us the usage information. To show a list of all installed versions of node.js and io.js, type nvm ls. Right now there is no version installed. If you want to see a list of all installable versions, use nvm ls-remote. As you can see, this is quite a long one, but there are some aliases to help us out. We want the latest version of node, so we simply type nvm install node. This will download and install the latest note jazz and set it as the current version. To set a version to be the default one use the alias command. From now nvm will default to whatever you set here. You can also use other aliases as it to target. Now that we have successfully installed node.js, let's start up our sever for the first time. Change to the /vagrant directory and run node index js. I can do that without running npm install because I already ran it on the host machine. And npm keeps all the dependencies in the note modules folder of the project, which is shared to the virtual instance. Sadly, when we try to start the server, we get an error stating that it can't connect to mongoDB. That's right, we haven't installed it yet. This, alongside with compiling and installing the writers key value store will be the topic of the next lesson. See you there.







