Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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 ...


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
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/

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

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