Install Node.js Raspberry Pi: Setting Up Node on Jessie

If you’re running Raspberry Pi OS (formerly Raspbian) on your Raspberry Pi, installing Node.js opens up a lot of options — from web servers and IoT projects to automation scripts like Twitter/X bots. Installing Node.js on Raspberry Pi OS Open a Terminal session from the taskbar. Update your package list first: sudo apt update && […]

Install Nodejs On Raspberry Pi
If you’re running Raspberry Pi OS (formerly Raspbian) on your Raspberry Pi, installing Node.js opens up a lot of options — from web servers and IoT projects to automation scripts like Twitter/X bots.

Installing Node.js on Raspberry Pi OS

  1. Open a Terminal session from the taskbar.
  2. Update your package list first: sudo apt update && sudo apt upgrade
  3. Install Node.js and npm via NodeSource’s setup script for the LTS release (recommended over the version in Raspberry Pi OS’s default repos, which is often quite old):
    curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
    sudo apt install -y nodejs
  4. Confirm the install: node -v and npm -v
Recent Raspberry Pi OS releases (based on current Debian releases) generally ship a reasonably current Node.js version in their own repos too — check apt list nodejs before adding the NodeSource repository, since sometimes the built-in package is now current enough that you don’t need the extra step at all.

Which Pi model does this work on?

The NodeSource install script above works on any current Raspberry Pi OS release across the 32-bit (armhf) and 64-bit (arm64) builds, so it’s the same process whether you’re on a Pi 4, Pi 5, or a Zero 2 W. On the original Pi Zero/Pi 1 (armv6), NodeSource dropped official armv6 builds some time ago — on those older boards, use an armv6-compatible Node build via a version manager like nvm, or check the Pi OS repo package first since it’s more likely to still carry an armv6-compatible build.

Managing multiple Node versions

If you need to switch between Node versions for different projects (rather than always running whatever NodeSource’s lts.x script installs), nvm (Node Version Manager) works on Raspberry Pi OS the same as on any other Linux distribution and avoids the need to reinstall system-wide each time you need a different version:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install --lts
Check the nvm project page for the current release tag if that version number has moved on since this was written.

Resources

1

Discover more from TechyGeeksHome

Subscribe to get the latest posts sent to your email.

Andrew Armstrong

Andrew Armstrong is a UK-based IT professional with 26+ years of hands-on experience in Windows, Windows Server, SCCM/ConfigMgr, Active Directory, PowerShell, and enterprise infrastructure.

He founded TechyGeeksHome in 2010 and has published over 1,500 practical guides covering real-world IT problems and solutions. When not solving IT problems,

Andrew develops free Windows utilities including Ultimate Settings Panel, which has been downloaded over 850,000 times.