Time for action – installing Node.js
Perform the following steps to install Node.js in Windows, OS X, and Ubuntu (Linux). You may skip directly to the section of the platform you are using.
Perform the following steps to install Node.js in Windows:
- Download the Node.js Windows installer from the Node.js download page (http://nodejs.org/download/). Choose your flavor for your Windows system, the 32-bit or 64-bit version, and the
.msi
or.exe
installer.Tip
32-bit or 64-bit
Follow this page to discover if your Windows computer is running on a 32-bit or a 64-bit system http://windows.microsoft.com/en-us/windows/32-bit-and-64-bit-windows.
- Run the installer (
.exe
or.msi
file). - Click on the Next button of the Node.js welcome message.
- As usual, when you are installing a software or application, you will first be prompted by the application's license agreement. Once you have read the license, click on I accept the terms in the License Agreement and then click on the Next button to proceed.
- Then, you will be prompted for the folder where Node.js should be installed. Leave it as the default folder, which is in
C:\Program Files\nodejs\
. - As you can see from the following screenshot, the installer then prompts to ask if you want to customize the item to be installed. Leave it as it is and click on the Next button to proceed, as shown in the following screenshot:
- Afterwards, click on the Install button to start installing Node.js.
- The installation process is quite fast; it takes only a few seconds. If you see the notification that says Node.js has been successfully installed, you may click on the Finish button to close the installation window.
Perform the following steps to install Node.js in OS X:
- Download the Node.js installer for OS X, which comes in the
.pkg
extension. - The installer will show you a welcome message and show you the location where it will install Node.js (
/usr/local/bin
), as shown in the following screenshot: - The installer then shows the user license agreement. If you read and agree to the license, click on the Agree button and then click on the Next button.
- The Node.js installer for OS X allows you to select which Node.js feature to install prior to installing it into your computer. Here, we will install all the features; simply click on the Install button to start installing Node.js, as shown in the following screenshot:
Note
If you want to customize your Node.js install, click on the Customize button at the bottom left, as shown in the previous screenshot.
Perform the following steps to install Node.js in Ubuntu:
Installing Node.js in Ubuntu is quite straightforward. Node.js can be installed through Ubuntu's Advanced Packaging Tool (APT) or apt-get
. If you are using Ubuntu version 13.10 or the latest version, you can launch the terminal and run the following two commands consecutively:
sudo apt-get install nodejs sudo apt-get install npm
If you are using Ubuntu version 13.04 or earlier, run the following command instead:
sudo apt-get install -y python-software-properties python g++ make sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs
What just happened?
We have just installed Node.js and npm
command, which enable us to use Bower later on through the Node.js Package Manager (NPM). The npm
command line should now be accessible through the Windows command prompt or the OS X and Ubuntu terminals. Run the following command to test if the npm
command works:
npm -v
This command returns the NPM version installed in the computer, as shown in the following screenshot:
Additionally, for Windows users, you may see a message at the top of the command prompt window saying Your environment has been set up for using Node.js and npm, as shown in the following screenshot:
This shows that you can perform the node
and npm
command within the command prompt. As we have set Node.js and npm
is up and running, we are now going to install Bower.
Have a go hero – get yourself familiar with command lines
Throughout this book, we will be dealing with a number of command lines to install Bower, as well as Bower packages. Yet, if you are from a graphic design background like I was, where we mostly work on a graphical application, operating a command line for the first time could be really awkward and intimidating. Hence, I would suggest you take time and get yourself familiar with the basic command lines. The following are a few references worth checking out:
- A Designer's Introduction to the Command Line by Jonathan Cutrell (https://webdesign.tutsplus.com/articles/a-designers-introduction-to-the-command-line--webdesign-6358)
- Navigating the Terminal: A Gentle Introduction by Marius Masalar (https://computers.tutsplus.com/tutorials/navigating-the-terminal-a-gentle-introduction--mac-3855)
- Introduction to the Windows Command Prompt by Lawrence Abrams (http://www.bleepingcomputer.com/tutorials/windows-command-prompt-introduction/)
- Introduction to Linux Command by Paul Tero (http://www.smashingmagazine.com/2012/01/23/introduction-to-linux-commands/)