Tuesday 7 June 2011

Installing Node.js on Ubuntu 11.04 and Mint 11

Installing Node.js is simple and let's you get play with all the Javascript goodness that it offers.

Another reason to install it is to use Flask-CSS (and hence lesscss) which I mentioned in my last article, so I thought I'd better cover that now.

Let's install it in our home directory:

cd ~
rm -fr node # in case this is a fresh install

sudo apt-get install -y g++ curl libssl-dev apache2-utils git-core
wget http://nodejs.org/dist/node-v0.4.9.tar.gz
tar xfz http://nodejs.org/dist/node-v0.4.9.tar.gz
cd node-v0.4.9 && ./configure 
# or the bleeding edge version
# git clone git://github.com/joyent/node.git 
# cd node && ./configure 
make 
sudo make install


and finally you need to add the following to your ~/.bashrc file:

export PATH="$HOME/node/bin:$PATH"

Finally install NPM (Node Package Manager):

source ~/.bashrc
curl http://npmjs.org/install.sh | sudo sh

Simples!

Thanks to:

3 comments:

  1. I found that I had to do "curl http://npmjs.org/install.sh | sudo sh" (notice the 'sudo') to install npm, otherwise I got permission denied errors.

    ReplyDelete
  2. Thanks Ted, that's because I forgot to say that you need to read in the change to teh bashrc file. I have added teh "source" line to do that.

    ReplyDelete