These instructions and tested and fully working on both squeeze and wheezy.
1. Install packages required to compile the source code
apt-get install build-essential
2. Download the latest source code from nodejs.org
3. Extract the tar archive
tar zxvf node-v0.10.9.tar.gz
4. Enter the directory we just extracted from the tar archive
5. Compile and install
6. Test node.js to make sure it’s working correctly
echo "console.log('Hello World');" | node
This should simply print “Hello World” in the console. If you don’t get any errors, node.js is installed and functional and you may just have executed your first node.js script.