Getting Started with Node.js

The secret of getting ahead is getting started. The secret of getting started is breaking your complex overwhelming tasks into small manageable tasks, and then starting on the first one.

Your one stop reference guide ☞ www.nodejs.org

Node.js

Holy GrailsNode.js on Github | Github Node Wiki | NPM Registry | Useful Tools & Resources

For a high-level introduction to Node.js, start here, Steve Vinoski's article on Node.js.

Installation

The Github Node Wiki contains excellent installation guide that explains how to get started installing Node.js and the Node Package Manager (NPM) on your system.

Prerequisites

Check the pre-requisites section in the installation guide and install packages listed there.

 sudo apt-get install git-core build-essential openssl libssl-dev pkg-config

If python3 is default on your system, before continuing with configure

mkdir /tmp/bin; ln -s /usr/bin/python2.7 /tmp/bin/python;
export PATH = /tmp/bin:$PATH

If you're compiling Node.js from source, you can follow these steps

mkdir -p ~/local/node
cd ~/workspace && git clone https://github.com/joyent/node.git
cd node && git checkout v0.8.18 # check nodejs.org for latest stable release
./configure --prefix=~/local/node
make -j2 && make install

# Edit ~/.bashrc to update the path variable
export PATH=$HOME/local/node/bin:$PATH
. ~/.bashrc
node --version && npm --version # to verify node and npm versions

Setting up Lint

You can install jslint or jshint, both of which are tools to detect errors and potential problems in JavaScript code.

npm install -g jshint
or
npm install -g jslint
# Run against your javascript code
jshint app.js

Some core concepts

This was a short how-to note on installing and getting started with node.js. Will add more articles on node.js in coming days.

Cheers, \m/

Vinayak Mishra

Vinayak Mishra, a Cricket Enthusiast with keen interest in web and mobile applications. Hails from Mithila, Nepal, married to Rani and dad to his bundle of joy Bunu. Lives in New Delhi, India. You can follow him on Twitter or check out his website, vnykmshr.com.