When Installing node.js on Debian you have two options:
Compiling it from source if you need the latest version of node.js
Installing it the Debian Way using the node.js package
available in the official Debian Sid (unstable) repo.
This post will describe how to install node.js from Debian's package manager.
Step 1: Adding the repo to /etc/apt/sources.list
First of all, you need to add the Debian Sid (unstable) repo to your /etc/apt/sources.list file:
deb http://ftp.debian.org/debian/ unstable main contrib non-free
Step 2: Setting aptitude's default Debian release in /etc/apt/apt.conf
Since node.js is the only package you
want to install from the Debian Sid (unstable) repo, you must set aptitude's
default release. This will prevent all of your packages from being updated to
the unstable version, and therefore prevent upgrading all of your system to Debian Sid (unstable).
Create a /etc/apt/apt.conf file and add the following line :
If you're using testing
If you're using stable
You may want to read about apt-pinning if you want to have more fine grained control
over which packages you wish to install on your system.
Step 3: Installing node.js from the package manager
Then install the package the way you usually do, the only difference is the -t option
which sets the release from which the package should be installed.
As of July 31, 2012 due to a naming conflict with the node
package (an Amateur Packet Radio Node Program), the nodejs package maintainers have renamed the binary from node to nodejs.
In other words, the node command has been renamed to nodejs. To change this behaviour,
install the nodejs-legacy package:
$ aptitude install -t unstable nodejs-legacy
This will symlink /usr/bin/node to /usr/bin/nodejs. This way you can use the node command
(instead of /usr/bin/nodejs as provided by Debian).
You can read more about this decision here
You may also want to install npm.
Although there is an available debian package in the Debian Sid repo, I recommend
installing it the "official" way: