Preparing for a Node.js hands-on lab

Home / Preparing for a Node.js hands-on lab

You’ve signed up for a Node.js hands-on lab, congratulations! Here are the steps you need to do to be prepared. Please do these 1 day before class!

  1. Install Node.js 0.10 on your computer – any version of node that begins with 0.10.something should work.
    1. Instructions for installing Node.js can be found here: How to install Node.js successfully
  2. Ensure you have development tools, if needed
    1. Mac OS: Install Xcode using the App Store – note this is a large file, over 1GB in size – you should do this before you come to class
    2. Linux: Install the development tools – this varies by distribution. On Ubuntu use: sudo apt-get install build-essential from the command line.
    3. Windows: Development tools aren’t needed
  3. Install MongoDB
    1. Mac OS with Homebrew: You can install using: brew install mongodb
    2. If you don’t have a Mac or you don’t know what Homebrew is, visit the website and download the installer for your platform.
  4. Install the Express.js command line utility:
    1. Mac OS: From a terminal, run: npm install -g express-generator
    2. Windows: Open “Node.js command prompt” (see step 3 in the installation instructions) and run: npm install -g express-generator
    3. Linux: Open a terminal and try to use: npm install -g express-generator  If you get an error about permissions you may need to use sudo. This is normally not recommended but some Linux distributions require it.
  5. Test your installation
    1. Download this zip file and unzip it or, if you prefer git, git clone
    2. From your terminal you previously opened change to that folder, for example: cd node-test
    3. Install the dependencies using npm install
    4. Run the test command: node index

 If you need help, please arrive at the classroom by 8:30am and you can get help configuring your computer.

Common solutions:

  1. You have to open Xcode and agree to the end-user license agreement before you can use the command line tools
  2. If you have an older Mac computer and it won’t run the latest Xcode you’ll need to download Xcode 4.6. If you can’t do that, I will have the installation on a USB drive in the classroom. Please arrive early to complete the setup. You may be able to download it from the Apple Developer Center.
  3. On Windows, when you open the Node.js prompt by clicking the Node.js icon none of the commands work. That’s because the Node.js prompt is not the same as the Node.js command prompt. This confuses many people at first. Look for another icon called “Node.js command prompt.”
  4. On Linux you may not have the npm command. This means you installed the version of Node.js that shipped with your Linux but you didn’t install npm. This probably means your Node.js version is quite old. I strongly recommend uninstalling Node.js and then following the instructions from step 1 above. If you’d rather not do that, you can install npm using your package manager.

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading posts...
Sort Gallery