How to install NodeJS on a Raspberry Pi

By | June 27, 2023

There are 2 main ways to install NodeJS on a Raspberry Pi. A short way and a longish way.

The short way

The short way uses a script from NodeSource that does the heavy lifting. The installation instructions can be found here but essentially you run 2 lines of code.

sudo curl -fsSL | bash -
sudo apt-get install -y nodejs
  • sudo means you are running the command as a super user
  • setup_20.x can be changed to whatever version of node you want to use.
  • install installs nodejs and the flag -y makes yes the default so you as the user won’t have to hit ‘y’ when a question appears

To confirm that node is installed, run

node -v

The long way

The slightly longer way involves downloading NodeJS directly from NodeJS. Before you do, run uname -m to show the architecture of your Pi. It will be ARM something.

Then head over to and find the Linux Binaries (ARM) version.

Right click and copy link address (eg: and then use wget to download the file.

sudo wget

Then extract it:

sudo tar -xvf
  • the -x flag means extract
  • the -v flag means verbose mode
  • the -f flag means perform the operation on this file

To run node from any directory, we need to copy the files we extracted to a folder that is in our PATH. To view your PATH run:

echo $PATH

cd (change directory) into your node folder you extracted and use the cp (copy) command:

sudo cp -R * /user/local/bin

Finally run node -v to see if it was installed successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *