Is there a precompiled binary of the latest Node.js that runs on the Raspbian OS?
Node.js distributes official pre-compiled binaries that works on Raspberry Pi:
cd /opt wget https://nodejs.org/dist/v9.4.0/node-v9.4.0-linux-armv6l.tar.xz sudo tar xzf node-v9.4.0-linux-armv6l.tar.xz sudo rm node-v9.4.0-linux-armv6l.tar.xz sudo ln -s /opt/node-v9.4.0-linux-armv6l /opt/nodejs sudo ln -s /opt/nodejs/bin/node /usr/bin/node sudo ln -s /opt/nodejs/bin/npm /usr/bin/npm
To update later, just download and extract the new tar file as above and replace the '/opt/nodejs' symlink with the new release:
sudo unlink /opt/nodejs sudo ln -s /opt/node-vX.X.X-linux-armv6l /opt/nodejs
A better approach would be cross-compiling. With that you can compile in your desktop machine and install into the RPi.
Take a look at http://www.raspberrypi.org/phpBB3/viewtopic.php?f=31&t=7493
For more recent versions of node than other answers provide, Adafruit has a repository that, as of node
v0.12.0 contains pre-compiled node.js.
Essentially, add the repository in
curl -sLS https://apt.adafruit.com/add | sudo bash
sudo apt-get install node
Note: Haven't tried this yet, but tutorial was published on
2014-12-19 at 04.57.54 PM and updated
2015-05-04 at 04.27.57 PM so seems more recent than other answers.
I was able to compile nodejs without issues using this method:
I've written a script that will install the Latest version of NodeJs. Don't wast the time to compile on a raspberry pi. This will work for all raspberry pi's despite processor types (ARM6, ARM7), The scripts handles all of that. All you need to do is run this line of code:
sudo wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | bash node -v;
source code is here: GitHub: NodeJs-RaspberryPi