Welcome to Node.js: Part 1 – Downloading and Installing Node.js
June 17, 2014
I’ve spent quite a few hours trying to figure out exactly which step to take. It was easy to find a half dozen different methods of downloading and installing Node.js and its brother or sister components. Figuring out which is the “best” one is not so easy. I didn’t end up finding one website that helped solve each problem I ran into, so I’ll retrace my steps. NOTE—I am using an Ubuntu 12.04 Virtual Machine (VM). If you are using Windows or Mac, there are easy installers available straight from Node’s home page.
STEP 0: Stuff I needed before…
Having started with a scratch Linux VM, I ran into quite a few problems attempting to follow various Node installation instructions as they often assumed the presence of several components normally present in Linux systems. I had to figure out what was needed on a trial-and-error basis. If for some reason you’re starting off in a similar position, follow these instructions below in the Terminal. Otherwise, skip to STEP 1.
apt-get install g++
apt-get install make
apt-get install git
STEP 1: …Downloading and installing Node.js
In my reading of methods to install Node.js, most sources had a link to this GitHub gist. It details a few different ways of doing it depending on your level of system familiarity, requirements, and all-around programming Jedi powers. Since I probably rank as waterboy to the coding Padawans, I opted for the first technique, node-and-npm-in-30-seconds.sh, just to see it work. (At which point I ran into the problems I eventually solved in STEP 0.) This install process will also include the Node Package Manager (npm), which is exactly what it sounds like—it’s a package manager for Node.
STEP 2: Hello World!
We probably have quite a while before computers choose for themselves to say, “Hello World!” but until then we coding novitiates will continue cutting our teeth on new programming languages by getting these famous words to the screen. After successfully installing Node it couldn’t be much simpler, according to the beginner’s guide I found at Modulus. Enter the Node shell from terminal by typing “node” and hitting enter. You’ll know you’re in the Node shell if a new line opens up with just the “>” character prompting you for input. Then pass the console.log command, and voila!
The Modulus beginner’s guide goes further than Hello World, but I’ll dive into that stuff in a later post.
Well, it took a little adventuring to find the “shallow end” of the Node.js pool. In the process I discovered (as will you) that Node.js and its affiliated technologies are really more of an ocean than a pool. As tools and services continue to change and improve, we may see Node slipping into and even overtaking more and more of the big, bad interwebs. In the next post, I’ll dive into the components of the MEAN stack, and we’ll figure out how each contributes to the web development process.