Install Node.js 14 and npm on Raspberry Pi

Node.js is an open-source runtime environment that allows to run JavaScript code on the server without a browser. It is based on Chrome’s V8 JavaScript engine. Node.js is commonly used to develop web applications. NPM is a package manager for Node.js that allows to install packages from remote registry.

Node.js 14 is a long-term support (LTS) release. This tutorial shows how to install Node.js 14 and npm on Raspberry Pi.

Connect to Raspberry Pi via SSH and add NodeSource repository that maintains Node.js 14 binary distributions.

curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -

Run command to install Node.js:

sudo apt install -y nodejs

Note that, we don’t need to install npm separately, it comes bundled with Node.js. After the installation is complete, check Node.js and npm versions:

node --version
npm --version

We can remove any package with a name that starts with nodejs and anything related to it by running the following command:

sudo apt purge -y nodejs.*

Leave a Comment

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