This post assumes your Raspberry Pi is already setup and you can SSH into it. If not, have a Google and come back. I’ll wait.
The Raspberry Pi Zero (and the original Raspberry Pi) use an ARMv6 CPU. Unfortunately
apt-get install nodejs installs a version of node built for ARMv7, so we’ll have to install it manually.
- Download the version of node you want, in this case I’m downloading v7.7.2 for ARMv6. Other versions can be found here.
- Extract the files once the download has completed.
tar -xzf node-v7.7.2-linux-armv6l.tar.gz
- Copy the files into /user/local
sudo cp -R node-v7.7.2-linux-armv6l/* /usr/local/
Add to path
To use the
npm commands you need to add the location we installed node (/user/local/bin) to your path.
- Open "~/.profile" for editing (I'm using nano)
PATH=$PATH:/usr/local/binat the end then press
ctrl + xto exit. Type
We should now remove the downloaded files to keep the file system clean.
- Remove the tarball
- Remove the extracted files
rm -r ~/node-v7.7.2-linux-armv6l
- Check that node is working with
node -vwhich will return the installed version, in my case v7.7.2.
- Check that npm is working with
npm -vwhich will return the installed version, in my case v4.1.2.