Installing node and npm

Here is how to install node and npm in ubuntu.

The ~/local directory is to store all of your user-level packages, btw.

mkdir -p ~/local
mkdir -p ~/node-latest-install

cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1

./configure --prefix=~/local   # if SSL support is not required, use --without-ssl
make install

cd ..
rm -rf ~/node-latest-install

Then in your ~/.bashrc file, append the following line.

export PATH=$PATH:'~/local/bin/'

Then source your new .bashrc by source ~/.bashrc

If everything goes well, the following commands should return the version info.

node -v
npm -v

ref: https://gist.github.com/dwayne/2983873

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s