Menu
User

DropVPS Team

Writer: Cooper Reagan

how to install NodeJS on ubuntu 24.04

how to install NodeJS on ubuntu 24.04

Publication Date

09/21/2025

Category

Articles

Reading Time

2 Min

Table of Contents

NodeJS is a popular JavaScript runtime that allows developers to run JavaScript outside the browser, making it a powerful tool for backend development and various automation tasks. Installing NodeJS on Ubuntu 24.04 enables you to build and run modern web applications efficiently. The installation process is straightforward and ensures that you have the latest stable version of NodeJS running on your system.

Update the Package Index

Updating the package index is an essential first step to ensure that you are installing the newest versions of software packages available. It refreshes the local list of available packages and their versions from the Ubuntu repositories.

sudo apt update

Install NodeJS and npm from Ubuntu Repositories

Ubuntu 24.04 includes NodeJS and npm (Node Package Manager) in its default repositories. Installing them directly is simple and provides a working setup suitable for many applications. npm is needed to manage JavaScript packages.

sudo apt install nodejs npm

Verify NodeJS and npm Installation

Confirming the installation ensures that NodeJS and npm are correctly installed and available from your terminal. Verifying the versions helps check that the installation was successful and lets you know which versions are running.

node -v
npm -v

Install NodeJS Using NodeSource Repository (Optional for Latest Version)

If the version from Ubuntu’s repositories is outdated, installing from NodeSource adds the latest NodeJS release to your system. This step adds a trusted external repository and installs a more recent NodeJS version.

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs

Confirm the Installation from NodeSource

After installing via NodeSource, verifying NodeJS again confirms that the new version is correctly installed and active in your system.

node -v

This sequence of steps ensures NodeJS is properly installed on Ubuntu 24.04, either through the default package repositories or the NodeSource repository for the latest stable version. Once installed, you are ready to start developing and running JavaScript applications on your Ubuntu machine. Testing your installation by running simple NodeJS commands or scripts can confirm everything is functioning as expected and that your environment is ready for development.

Linux VPS
U
Loading...

Related Posts