Like Dave Swersky said in a comment, yes you can, there s a complete tutorial here:
http://blog.rueedlinger.ch/2013/03/raspberry-pi-and-nodejs-basic-setup/
I would add it work well, but you ll need to use Leafpad (if GUI) or nano to edit your code, they are good text editor, but no syntax coloration.
EDIT: For thoses who don t want to see the link, here a quick resume of it:
Creating a new directory for node:
sudo mkdir /opt/node
Get the package for Raspbian: (vX.XX.X is to be replaced by latest one)
wget http://nodejs.org/dist/vX.XX.X/node-vX.XX.X-linux-arm-pi.tar.gz
tar xvzf node-vX.XX.X-linux-arm-pi.tar.gz
sudo cp -r node-vX.XX.X-linux-arm-pi/* /opt/node
Add node.js to the PATH:
nano /etc/profile
Add this before 'export'
NODE_JS_HOME="/opt/node"
PATH="$PATH:$NODE_JS_HOME/bin"
export PATH
It is a rip off of the basic installation of node.js as explained in the link, I didn t writed it, but tested it successfully on two Raspberry.
For more information about why thoses command, and how to properly configure the RPi, go to the link, the real author deserve the credit.
EDIT 3 (Inserted before EDIT2 since more related to the question)
For the hardware io with the RPi, you can use the popular socket.io package, or some speciallized module as pi-gpio.
EDIT 2:
For nano syntax coloration, copy this in a file named js.nanorc, at ~/ for this example
Then use this command:
cp /etc/nanorc ~/.nanorc
nano ~/.nanorc
To create a user nano config file and edit it.
Read all option and uncomment those you want, I reccommend to activate:
set autoindent
set tabspace 4
set tabstospace
set whitespace " °"
So you have auto indent, and tabs are made of 4spaces, and by typing alt + P, you see all whitespace replaced by ° (only visual, they aren t replaced in the file)
Then, at the end of the file, type
include "~/js.nanorc"
So you now have coloration for javascript too.