Install node.js on Raspberry PI in two simple steps
[ Updated Jan 20, 2013 ] Check out my git repository https://github.com/midnightcodr/rpi_node_install if you are interested in putting newer version of node to raspberry pi (tested with 0.8.14, os runs raspbian)
1) Install the newest wheezy image onto the sd card (currently 2012-07-15-wheezy-raspbian.zip) from http://www.raspberrypi.org/downloads
2)
sudo apt-get install nodejs npm
, press y, Enter when prompted, you will get node.js (v0.6.19) and npm (1.1.4) installed in a few minutes, which should be the easiest way to get node.js and npm up and running on RP.
Note: If you want newer version of node.js you might want to check this out: http://www.raspberrypi.org/phpBB3//viewtopic.php?f=34&t=9929, I have tested the method described in this post in the previous release of wheezy (http://www.raspberrypi.org/archives/1435) and I assume it should work with the current image as well.
doesn’t work!!!
Wouldn’t it be better if you could share the problem you experienced in detail instead of putting “doesn’t work” as comment?
Reblogged this on Gigable – Tech Blog.
Do you know what repository one needs to include to install via apt?
No external repository is required. My raspberry pi is running the latest raspbian (wheezy/sid) with the following repository:
If you have problem installing node.js and npm, make sure you run the followings before installing them:
sudo apt-get update
Ah, thanks ricoh3n! I’m still on squeeze – time to upgrade it seems
No problem. Upgrade to the newest version (wheezy) is strongly recommended. In addition to solving the nodejs/npm installation problem, you would also get the benefit of easy overclocking (via the new raspi-config, see http://www.raspberrypi.org/archives/tag/overclocking for detail).
I installed node. Typing node, nothing happens? Not even a little “Hello World” is working:
test.js:
var sys = require(“sys”);
sys.puts(“Hello World”);
Trying: pi@raspberrypi ~ $ node test.js
has the response: pi@raspberrypi ~ $
node doesn’t work?
Marcus
What are the outputs of the following commands:
which node
file `which node`
Thank You for trying to help!
The result of the commands:
pi@raspberrypi ~ $ which node
/usr/sbin/node
pi@raspberrypi ~ $ file `which node`
/usr/sbin/node: symbolic link to `ax25-node’
pi@raspberrypi ~ $
It seems to be the wrong node? How can I correct this?
Seems on your rpi you have package ax25-node installed. The command that comes with it (ax25-node) is symlinked to /usr/sbin/node (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614907). You have a couple of options:
1. Remove symlink /usr/sbin/node and run ax25-node using command ax25-node if you need to, or
2.Enter the full path of node (for node.js) when running js scripts, for example: /usr/bin/node test.js
node and npm is removed – apt cannot locate package.
debian wheezy is up to date, sudo apt-get upgrade and sudo apt-get update both say so.
Chris, you might want to check out the node installation script for rpi https://github.com/midnightcodr/rpi_node_install