Table of Contents
What you will read?
Node.js is a powerful runtime for building modern web applications, APIs, and scalable server-side services. If you are using Ubuntu 25.04, installing Node.js correctly ensures you can run JavaScript applications efficiently.
Step 1: Update Your System
It is always best to start by updating your system. This prevents package conflicts and ensures that you install Node.js in a stable and up-to-date environment:
sudo apt update
sudo apt upgrade -y
Step 2: Add the NodeSource Repository
The default Ubuntu repositories may not provide the latest Node.js version. To get the current stable release, use the official NodeSource repository:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
This installs both Node.js and npm at once.
Step 3: Verify Node.js and npm
After installation, check that Node.js and npm are working properly by confirming their versions:
node -v
npm -v
If you see version numbers, the installation was successful.
Step 4: Install Build Tools (Optional)
Some npm packages need to be compiled from source. To avoid errors during installation of such packages, it’s recommended to install essential build tools:
sudo apt install -y build-essential
Now Node.js and npm are fully installed on Ubuntu 25.04, ready for building and deploying modern JavaScript applications.
