Skip to content

Instantly share code, notes, and snippets.

@justinjenkins
Created January 16, 2015 03:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinjenkins/16adc15338bb265f6808 to your computer and use it in GitHub Desktop.
Save justinjenkins/16adc15338bb265f6808 to your computer and use it in GitHub Desktop.
Installing and using node.js on Raspberry Pi

##Fixing npm on Raspberry Pi

I can't promise this is the right way to do it but this fixed my issue not being able to install things via npm on my Raspberry Pi ...

source http://raspberryalphaomega.org.uk/2014/06/11/installing-and-using-node-js-on-raspberry-pi/

The error I was getting was:

npm ERR! Error: failed to fetch from registry:

For example:

npm install node-hue-api

To fix this do the following:

sudo apt-get update
sudo apt-get upgrade

Remove nodejs if it already exists

sudo apt-get remove nodejs

Install node

sudo su -
cd /opt
wget http://nodejs.org/dist/v0.10.25/node-v0.10.25-linux-arm-pi.tar.gz
tar xvzf node-v0.10.25-linux-arm-pi.tar.gz
ln -s node-v0.10.25-linux-arm-pi node
chmod a+rw /opt/node/lib/node_modules
chmod a+rw /opt/node/bin
echo 'PATH=$PATH:/opt/node/bin' > /etc/profile.d/node.sh

Now logout/login of terminal session and test via node --version

@sjjf
Copy link

sjjf commented Mar 12, 2015

I found some later linux-arm-pi builds, but they all hit issues with illegal instructions - 0.10.25 seems to be the latest version that still works.

I also couldn't get a successful build of the latest version (0.12.0) on my pi - the build failed somewhere in the v8 build, and the raspbian packaged version of v8 seems to be too early to build against.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment