There are many amazing things that you can do with Node.js and Raspberry Pi. From interacting with the GPIO pins to even building apps, Node.js is capable of doing many things on the Raspberry Pi. Follow this tutorial to install Node.js on the Raspberry Pi.
I] Parts Required
- 1x Raspberry Pi( I have used a Raspberry Pi 4 Model B)
- 1x 5V USB power adapter
- 1x Ethernet Cable
II] Check your ARM version
Raspberry Pi uses ARM processors. To check the version, open a terminal and type uname -m
Raspberry Pi 4 has armv7l.
III] Download the official Node.js Linux ARM binaries
Go to the node.js website
Copy the link address of the Linux binaries corresponding to the ARM version.
Open a terminal (Ctrl+Alt+T) and type wget and copy the link address. Change the extension to tar.gz.
wget link-address.tar.gz
IV] Extract the archives and copy node to the local user folder
tar -xzf node-v12.16.2-linux-armv7l.tar.gz
Type the above command in a terminal. The latest version at the time of writing this article is 12.16.2 and my ARM is armv7l. Change that suitably depending on the latest release of node.js and the ARM version in your Raspberry Pi.
Type the commands given below in a terminal to change directory to the node directory and copy that to the usr/local folder:
cd node-v12.16.2-linux-armv7l/
sudo cp -R * /usr/local/
If you followed the steps above, node.js should successfully be installed in your Raspberry Pi!