Beginner’s Guide to Installing Node.js on a Raspberry Pi

Learning through Making (LTM) logo

This article has been updated to cover the installation of the latest version of Node at the time of this writing which is Node 8.x.

In this installment of our LTM (Learning through Making) series of Node.js tutorials, we’re going to get Node up and running on a Raspberry Pi 3 or Pi 2. With the Raspberry Pi 3, you won’t need to buy a separate USB Wi-Fi adapter. I’m focusing on the Raspberry Pi 3/Pi 2 rather than older versions such as the Raspberry Pi B+ since these are the latest models at the time of this writing.  The Raspberry Pi 3, for example, sports a 1.2 GHz quad-core ARMv8 chip with 1 GB of RAM versus the Raspberry Pi 1 Model B+’s 700 MHz single-core ARMv6 chip with 512 MB RAM.

The instructions provided here are for installing Node.js on a Pi 3 (ARMv8) or Pi 2 (ARMv7) rather than other models based on the ARMv6 chip such as the Raspberry Pi 1 Model B, Raspberry Pi Model B+ or the Raspberry Pi Zero.  A majority of this installation guide should still prove useful for other Raspberry Pi systems besides the Pi 3 and Pi 2; however, the final steps focused on the installation of Node.js will not work for these systems based on the older ARMv6 architecture.

This tutorial is useful for anyone wishing to successfully install a Raspberry Pi 3/Pi 2 system, even if they are not interested in Node.js since the Node.js installation happens in the final steps of the tutorial.  But, why would you not want to install Node.js? 🙂  Let’s get started! Continue reading

Share

Solution for Can’t Ping Raspberry Pi Hostname on the Network

In preparing for my upcoming tutorial which is a beginner’s guide to installing Node.js on a Raspberry Pi 2, I ran into an issue. After getting the RasPi is up and running on the network, I was not able to ping its hostname (raspberrypi, by default) from another machine and find it so I could connect to it through Putty, xrdp, VNC, etc.  After all, I wanted to be able to run headless and disconnect the monitor, USB keyboard/mouse, and still connect to it from another machine on my network.

One option was to run ifconfig on the RasPi and take note of the IP address for eth0 (if connected through Ethernet) or wlan0 (if connected through Wi-Fi).  I could then hard code this IP address in the hosts file on the Windows (or other) machine. The problem is that the RasPi retrieves its IP address through DHCP by default from my local router at home, and this IP address is not guaranteed to remain the same.  I could log into my router and note the static IP address range and reconfigure the RasPi to use one of these static IP address rather than DHCP.  However, I am preparing a beginner’s tutorial and not all of my readers want to become Linux TCP/IP networking experts.

I discovered an elegant solution if you are trying to ping and connect to the RasPi from another Windows machine on the same network.  Samba to the rescue! Continue reading

Share