Home → Articles → How to Install Node.js and NPM on Ubuntu 26.04

How to Install Node.js and NPM on Ubuntu 26.04

07 May, 2026

Introduction

Node.js is a JavaScript runtime built on Chrome's V8 engine that allows developers to run JavaScript code outside a web browser. This open-source, cross-platform environment excels at building fast, scalable network applications such as web servers, API backends, and real-time services. NPM (Node Package Manager) accompanies Node.js and provides access to over a million reusable code packages, making dependency management straightforward for JavaScript projects. Together, Node.js and NPM form the foundation for modern full-stack and backend JavaScript development.

This tutorial teaches you how to install Node.js version 24.x and NPM on Ubuntu 26.04 using the official NodeSource repository.

Prerequisites

Before you begin:

Update System Package Information

Before installing any new software, refresh your system's package index to ensure you get the latest available versions from the Ubuntu repositories.

Install Required Dependencies

The NodeSource installation script requires curl to download the setup script and ca-certificates to verify SSL certificates securely.

Add NodeSource Repository

NodeSource provides up-to-date Node.js binaries that are not always available in the default Ubuntu repositories. The official NodeSource setup script configures your system to pull Node.js version 24.x packages.

Install Node.js and NPM

After adding the NodeSource repository, you can install Node.js, which automatically includes NPM as part of the package.

Verify Node.js and NPM Installation

Confirm that both Node.js and NPM installed correctly and check their versions to ensure you have the expected releases.

Create a Test JavaScript Application

To validate that your Node.js environment works correctly, create a simple HTTP server that responds with a welcome message when accessed.

Press Ctrl + C to stop the server.

Manage Global NPM Package Permissions

When you install NPM packages globally using npm install -g, NPM writes files to system directories that require elevated permissions. To avoid using sudo with NPM, change the default global package directory to a location within your home folder.

Install a Global NPM Package as a Test

Test your NPM configuration by installing a popular global package that helps manage Node.js processes.

Your Node.js and NPM installation is ready for development.

Conclusion

In this guide, you have installed Node.js version 24.x and NPM on Ubuntu 26.04 using the official NodeSource repository, verified the installation, created and ran a test HTTP server, and configured global NPM package permissions. Now that you have Node.js and NPM running, consider building your first Express.js web application or explore the NPM registry to discover packages that accelerate your JavaScript development workflow.