Camkode
Camkode

How to Install Node.js on Ubuntu 25.04 (Step-by-Step Guide)

Posted by Kosal

How to Install Node.js on Ubuntu 25.04 (Step-by-Step Guide)

If you're developing JavaScript applications or working with tools like React, Angular, or Vue, you'll need Node.js and npm (Node Package Manager) installed on your Ubuntu system.

This guide walks you through installing Node.js v23.x on Ubuntu 25.04 using the official NodeSource repository.

Step 1: Update Your System

First, make sure your package list is up to date.

sudo apt update

This ensures your system knows about the latest available versions of packages.

Step 2: Download the NodeSource Setup Script

NodeSource provides a script to set up the required repository for the latest Node.js version (v23.x in this case).

Use curl to download the script:

sudo curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh
  • fsSL: Makes curl silent and fail-safe.
  • o nodesource_setup.sh: Saves the script as a file named nodesource_setup.sh.

Step 3: Run the Setup Script

Now, execute the script to add the NodeSource repository to your system:

sudo -E bash nodesource_setup.sh
  • E: Preserves environment variables (like proxy settings) when using sudo.
  • This step adds the required GPG key and repository to your system's package sources.

Step 4: Install Node.js and npm

After the repository has been added, install Node.js along with npm (Node Package Manager) using:

sudo apt-get install -y nodejs npm
  • y: Automatically confirms the installation prompts.
  • This command installs both Node.js runtime and npm in one go.

Step 5: Verify Installation

Check that Node.js and npm are installed correctly by verifying their versions:

node --version
npm --version

You should see something like:

v23.x.x
10.x.x

(Your version numbers may vary depending on the latest releases.)

🎉 You're Done!

You now have Node.js and npm installed on your Ubuntu 25.04 system. You're ready to start building modern web applications, install global packages like express, vite, create-react-app, or use Node.js for scripting and automation!

Optional: Keep Node.js Updated

To upgrade Node.js in the future, just repeat steps 2 to 4 using the latest version number in the URL (e.g., setup_24.x when Node.js 24 is released).