Posted by Kosal
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.
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.
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
.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
.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.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 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!
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).