Installing Node.js on Raspberry Pi

by / Monday, 09 November 2015 / Published in node, RaspberryPI, Raspbian, Technical
nodejs

 

 

 

 

 

Get the arm version of the raspberry pi using the following command:

pi@raspberrypi ~ $ cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 2.00
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 000d
Serial : 00000000b4719753
pi@raspberrypi ~ $

You can also use:

pi@raspberrypi ~/node-v4.2.2-linux-armv6l $ uname -a
Linux raspberrypi 4.1.7+ #817 PREEMPT Sat Sep 19 15:25:36 BST 2015 armv6l GNU/Linux
pi@raspberrypi ~/node-v4.2.2-linux-armv6l $

Download the correct version from node website.

Download the node file using wget

pi@raspberrypi ~ $ wget https://nodejs.org/dist/v4.2.2/node-v4.2.2-linux-armv6l.tar.gz
--2015-11-09 00:19:44-- https://nodejs.org/dist/v4.2.2/node-v4.2.2-linux-armv6l.tar.gz
Resolving nodejs.org (nodejs.org)... 2400:cb00:2048:1::6814:162e, 2400:cb00:2048:1::6814:172e, 104.20.23.46, ...
Connecting to nodejs.org (nodejs.org)|2400:cb00:2048:1::6814:162e|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10998321 (10M) [application/gzip]
Saving to: ‘node-v4.2.2-linux-armv6l.tar.gz’
node-v4.2.2-linux-armv6l.tar.gz 100%[================================================================================================================>] 10.49M 1.24MB/s in 15s
2015-11-09 00:20:01 (699 KB/s) - ‘node-v4.2.2-linux-armv6l.tar.gz’ saved [10998321/10998321]
pi@raspberrypi ~ $

Untar the file using the following command:

pi@raspberrypi ~ $ tar -xvf node-v4.2.2-linux-armv6l.tar.gz

Change the directory to node-v4.x.x-linux-armv6l/lib/node_modules/npm

pi@raspberrypi ~ $ cd node-v4.2.2-linux-armv6l/lib/node_modules/
pi@raspberrypi ~/node-v4.2.2-linux-armv6l/lib/node_modules $ pwd
/home/pi/node-v4.2.2-linux-armv6l/lib/node_modules
pi@raspberrypi ~/node-v4.2.2-linux-armv6l/lib/node_modules $

Run the following commands one after the other:


./configure
make
sudo make install

Check the following to confirm that node and npm are installed.

pi@raspberrypi ~ $ which node
/usr/local/bin/node
pi@raspberrypi ~ $
pi@raspberrypi ~ $ node -v
v4.2.2
pi@raspberrypi ~ $ which npm
/usr/local/bin/npm
pi@raspberrypi ~ $
pi@raspberrypi ~ $ npm -v
2.14.7
pi@raspberrypi ~ $
Tagged under: , ,

Leave a Reply

TOP