Install-NodeJs-on-Raspberry-Pi

25 Oct 2023
Author: Richard Djarbeng

For an updated version of this post see this post: Installing NodeJs on the Pi -linux based system

How to install NodeJs on the Raspberry Pi 4

Tested on Raspberry Pi 4B using the terminal Steps: Assuming you have a Raspberry Pi already setup. If you need help setting up find resources here

  1. Turn on the raspberry Pi.
    Optional: If you are not using a monitor you can ssh into the Raspberry Pi and run the commands from there.
  2. Open a terminal window
  3. Run these commands to download node version 18.18.0 (LTS) from the terminal on the Raspberry Pi. You need to copy and paste these into the terminal or use a bash script.

Commands

wget https://nodejs.org/dist/v18.18.0/node-v18.18.0-linux-armv7l.tar.xz

tar -xvf node-v18.18.0-linux-armv7l.tar.xz
cd node-v4.4.2-linux-armv7l
sudo cp -R * /usr/local/

Check installation

  1. To check if the NodeJs installation worked run this:
    node –-version
    

This should print out the current NodeJs version; The commands given installed version 18.18.0. For installing packages npm should come installed with your version of NodeJs if you installed a recent version of NodeJs.

Installing different Node versions

Optional If you wish to change the node version to install, you can change the link in the command. Here we used version 18.18.0: https://nodejs.org/dist/v18.18.0/node-v18.18.0-linux-armv7l.tar.xz

but you can use any link from the NodeJs download page . Use the ARM7 linux binaries link if you need to install a different version on the Raspberry pi 4B.

image