Installing Node.js + npm + Express + Mongoose on Ubuntu 11.04

Unfortunately, it’s not easy at all.

Fortunately, I have a solution, since

  • apt-get install nodejs with native untouched /etc/apt/sources.list FAILED
  • git clone —depth 1 git://github.com/joyent/node.git FAILED
  • curl http://npmjs.org/install.sh  FAILED

And now, the solution :

sudo apt-get install g++ curl libssl-dev apache2-utils git-core

So, following the Ubuntu paragraph in the Node’s Github wiki dedicated page:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

# And then 

cd /tmp
git clone http://github.com/isaacs/npm.git
cd npm
sudo make install

# And then

npm install express
npm install mongoose
npm -ls

so now npm ls will finally gives you :

├─┬ express@2.4.3 
│  ├── connect@1.6.0 
│  ├── mime@1.2.2 
│  └── qs@0.3.0 
└─┬ mongoose@1.7.4 
   ├── colors@0.5.0 
   ├── hooks@0.1.9 
   └── mongodb@0.9.6-7 

Tags: nodejs ubuntu