The .pkg
file is for OSX. There are some repositories that have binaries for Debian, but it is probably easiest to download and compile the code. NodeJS is updated very frequently - so most repositories have very outdated versions. You will need some development tools (compiler, etc.) to be able to build the source.
sudo apt-get update
sudo apt-get install curl build-essential openssl libssl-dev
You can either download the source from the Node.JS site or pull it from github. The advantage of the latter is ease of maintenance.
NodeJS:
If you wish, you can install node to a directory other than the default, by adding --prefix /path/to/install/directory to your configure line, below. (Only use one of the following, not both)
From GitHub:
sudo apt-get install git-core
cd /usr/local/src ##or whatever directory you like#
git clone https://github.com/joyent/node.git && cd node
./configure
make
sudo make install
From source - tarball:
cd /usr/local/src ##or whatever directory you like#
wget http://nodejs.org/dist/v0.6.6/node-v0.6.6.tar.gz
tar -xzvf node-v0.6.6.tar.gz
cd node-v0.6.6
./configure
make
sudo make install
NPM:
NPM is already included with recent versions of node. Verify that it is installed with npm -v. If a version is displayed, there is no need to do the step below. If the 'easy install' doesn't work for you, you can also download the code and make install.
curl http://npmjs.org/install.sh | sudo sh