First things first, for this little project I am using:
A Rasperry Pi 3 – as it has built in WiFi. A different Raspberry Pi can be used but please note the Pi, Pi 2 and Pi Zero all require either a physical connection or a WiFi adapter. Also please note that the Pi 3 uses an ARM v8 processor where as the other Pi models (e.g. the Pi 2) do not.
Raspbian OS – currently my Pi is running Raspbian Stretch (released June 2018). If you are using a different version of Raspbian then there may be some changes needed to get Node.js working.
I am connecting to my Pi via SSH, however the same terminal instructions can be used directly on the Pi. I prefer using SSH as it frees me up from being near the television (where the Pi is connected) and frees the TV up for others in the house to use. On a side note, if you are using SSH please make sure you have followed good security practise and have changed the default Pi password.
With SSH connected I recommended making sure that the Pi’s update catalog is up to using the sudo apt-get update command, and that the Pi is then up to date using the sudo apt-get upgrade command.
With everything up to date it is time to let the Pi know where to get Node.js from. Raspbian is part of the Debian Linux family, as such it has repositories containing information about packages/applications. To let Raspbian know where to get Node.js from the following command is needed:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash –
Raspbian now knows about Node.js and where to get it but has not yet installed it. To install Node.js the following command is needed:
sudo apt-get install -y nodejs
As long as no error messages occur, Node.js should now be installed on the Raspberry Pi. To test that Node.js is installed and check which version is installed we can enter the following command:
The above shows that v8.12.0 is installed on the Raspberry Pi.
Node.js is now ready for use! Node.js can be launched by typing node at the terminal and can be exited by typing .exit or by pressing CTRL C (twice).
Node.js Official Site:
Raspbian OS Download:
Wikipedia page about Node.js: