Install Node.js on Debian 6

Multithreaded JavaScript, O'Reilly 2021, is available for early access and pre-order!
DEPRECATED: This post may no longer be relevant or contain industry best-practices.

If you're like me, you prefer to install Linux packages via the systems package manager. By doing so, whenever you run your update command, you're going to get the most current copy of everything. Unfortunately, Debian doesn't seem to have Node.js in their package repo by default:

$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree 
Reading state information... Done
E: Unable to locate package nodejs

Oh no! Thankfully, we can download the package source and compile it that way. Unlike a lot of tarballs I've used throughout the years, I've yet to have a hitch compiling Node on any of my Debian machines.

Run the following commands to get Node.js installed on your machine. In my example I'm grabbing the latest, v0.8.16, but you'll want to visit the download page and get the URL of the most current version.

$ sudo apt-get install build-essential
$ wget
$ tar -xzf node-v0.8.16.tar.gz
$ cd node-v0.8.16/
$ ./configure
$ make
$ sudo make install

If everything went as plan, you should have both node and npm installed and ready to go:

$ node -v
$ npm -v
Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript, is an O'Reilly published author, and is an organizer of NodeSchool SF.