Node.js is a powerful JavaScript runtime built on Chrome’s V8 engine, and knowing how to complete a nodejs install ubuntu 26.04 is an essential skill for developers and system administrators alike. This guide walks you through every available installation method so you can choose the one that best fits your workflow and version requirements.
In this tutorial you will learn:
- How to install Node.js from Ubuntu 26.04’s default repositories
- How to install a specific Node.js LTS or current version via the NodeSource repository
- How to manage multiple Node.js versions using NVM
- How to verify the installation and check the installed version
- How to use npm to manage Node.js packages
- How to safely uninstall Node.js from Ubuntu 26.04
Software Requirements
| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | Ubuntu 26.04 Resolute Raccoon |
| Software | Node.js 20.x LTS / 22.x LTS / latest current release, npm (bundled), nvm (optional) |
| Other | Privileged access to your Linux system as root or via the sudo command. |
| Conventions | $ sudo – requires given linux commands to be executed with root privileges by use of the sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
| Step | Command/Action |
|---|---|
| 1. Install NVM | curl -o- | bash |
| 2. Reload shell | source ~/.bashrc |
| 3. Install Node.js LTS | nvm install --lts |
| 4. Verify installation | node --version && npm --version |
Method 1: Install Node.js from Ubuntu Repositories
The simplest way to perform a nodejs install on Ubuntu 26.04 is to use the packages available directly in Ubuntu’s default repositories. This method requires no additional repository configuration and therefore integrates cleanly with the system package manager. The trade-off is that the version included in the repos may lag behind the latest upstream release.
First, update the package index to ensure you have the most current information:
- Update package index: Refresh the apt package cache before installing anything.
$ sudo apt update
This ensures apt is aware of the latest available packages in all configured repositories.
- Install Node.js and npm: Install both Node.js and its package manager in a single command.
$ sudo apt install nodejs npm
Ubuntu 26.04 bundles
npmseparately fromnodejsso both package names are required here.


IMPORTANT
The Node.js version in Ubuntu’s default repositories may not be the latest LTS. If your project requires a specific Node.js version, use Method 2 or Method 3 instead.
Method 2: Install Node.js via NodeSource Repository
The NodeSource repository provides up-to-date Node.js packages for Debian-based distributions, including Ubuntu 26.04. This method consequently gives you access to specific major versions such as Node.js 20 LTS or Node.js 22 LTS without having to manage multiple runtime versions yourself.
NodeSource provides a setup script that configures the repository and installs the required GPG key automatically. Choose the major version you need before running the script.
- Install prerequisites: Ensure
curlis available to download the setup script.$ sudo apt install -y curl
- Add the NodeSource repository: Run the setup script for your desired Node.js major version. The example below sets up Node.js 22.x (current LTS at time of writing).
$ curl -fsSL | sudo bash -
The script adds the NodeSource apt repository and imports its GPG signing key. Replace
22.xwith20.xif you require the Node.js 20 LTS branch. - Install Node.js: After the repository is configured, install Node.js with apt.
$ sudo apt install -y nodejs
This package from NodeSource includes
npmbundled together, so no separate npm installation is necessary.


IMPORTANT
NodeSource packages bundle npm, so you do not need to install npm separately when using this method. Running apt install nodejs npm would install a conflicting npm version from the Ubuntu repos.
Method 3: Install Node.js via NVM
Node Version Manager (NVM) is the most flexible approach to performing a nodejs install on Ubuntu 26.04, especially if you work on multiple projects that require different Node.js versions. NVM installs Node.js in your home directory, meaning you do not need root privileges for installation or version switching. Moreover, switching between Node.js versions is a single command operation.
- Download and run the NVM install script: The official NVM installer script handles everything automatically.
$ curl -o- | bash
The script clones the NVM repository to
~/.nvmand adds the required initialization lines to your shell profile (~/.bashrc,~/.zshrcor~/.profiledepending on your shell). - Reload your shell configuration: Apply the changes to your current session without logging out.
$ source ~/.bashrc
After this step, the
nvmcommand becomes available in your terminal. - Verify NVM is installed: Confirm that NVM loaded correctly.
$ nvm --version
You should see the NVM version number printed to the terminal.
- List available Node.js versions (optional): Browse the available LTS and current releases.
$ nvm ls-remote --lts
- Install Node.js LTS: Install the latest Long-Term Support release.
$ nvm install --lts
Alternatively, install a specific version by number, for example
nvm install 22.3.0. - Set a default Node.js version: Make a version the default across new terminal sessions.
$ nvm alias default node
This ensures the most recently installed version is used in all future sessions.


Switching Between Node.js Versions with NVM
One of the key advantages of NVM is the ability to switch between installed Node.js versions instantly. This is particularly useful when maintaining legacy applications alongside modern projects.
- Install an additional version: Install Node.js 20 LTS alongside the current version.
$ nvm install 20
- Switch to a specific version: Use that version for the current shell session.
$ nvm use 20
- List installed versions: View all Node.js versions currently managed by NVM.
$ nvm ls


Verify the Node.js Installation on Ubuntu 26.04
Regardless of the installation method you chose, verifying the nodejs install on Ubuntu 26.04 ensures everything is working correctly before you begin development.
- Check the Node.js version:
$ node --version
Expected output (version will vary):
v24.14.0
- Check the npm version:
$ npm --version
Expected output:
11.9.0
- Run a quick test script: Confirm the runtime executes JavaScript correctly.
$ node -e "console.log('Node.js is running on Ubuntu 26.04')"Expected output:
Node.js is running on Ubuntu 26.04


COMPLETED
If all three commands above returned expected output, your Node.js installation on Ubuntu 26.04 is complete and working correctly.
Managing Packages with npm
After completing the nodejs install on Ubuntu 26.04, npm is immediately available for package management. npm is the default package manager for Node.js and provides access to the largest ecosystem of open-source libraries in the world.
Here are the most common npm operations you will use regularly:
- Initialize a new Node.js project: Create a
package.jsonfile in the current directory.$ npm init -y
The
-yflag accepts all default values, which speeds up project initialization. - Install a package locally: Add a dependency to your current project.
$ npm install express
The package is installed in the
node_modulesdirectory and recorded inpackage.json. - Install a package globally: Install a CLI tool available system-wide.
$ npm install -g nodemon
Global packages are useful for development tools you want accessible from any directory.
- Update npm itself: Keep npm up to date with the latest release.
$ npm install -g npm@latest
IMPORTANT
When using NVM, global npm packages are installed per Node.js version. If you switch versions with nvm useyou may need to reinstall global packages for that version.
Uninstalling Node.js from Ubuntu 26.04
The uninstall procedure depends on which method you used to install Node.js.
- Uninstall (apt method): Remove Node.js and npm installed from Ubuntu repositories or NodeSource.
$ sudo apt remove nodejs npm $ sudo apt autoremove
The
autoremovecommand additionally cleans up any orphaned dependency packages. - Uninstall a specific NVM version: Remove a single version while keeping others.
$ nvm uninstall 20
- Remove NVM entirely: Uninstall NVM and all Node.js versions it manages.
$ rm -rf ~/.nvm
After removing the directory, also delete the NVM initialization lines from your
~/.bashrcor shell profile file.
Conclusion
This guide covered three distinct methods to nodejs install on Ubuntu 26.04: using the default Ubuntu repositories for simplicity, using the NodeSource repository for a specific major version, and using NVM for maximum flexibility across multiple versions. For most development workflows, NVM is the recommended approach because it allows version switching without root access and keeps your system Node.js installation untouched. For production servers where a single pinned version is required, the NodeSource method provides well-maintained, up-to-date packages through the standard apt workflow. Additionally, always verify your installation after completing any of these methods to confirm everything is working as expected before starting your project.
Frequently Asked Questions
- Which Node.js installation method is best for Ubuntu 26.04? It depends on your use case. NVM is the best choice for developers who need to switch between Node.js versions across different projects. The NodeSource repository is ideal for servers that require a specific, well-maintained LTS version managed through apt. The Ubuntu default repositories are suitable if you only need Node.js for a basic use case and do not require the latest version.
- Can I install multiple Node.js versions on Ubuntu 26.04 at the same time? Yes, but only NVM supports this natively. With NVM, you can install as many Node.js versions as you need and switch between them using
nvm use <version>. The apt-based methods (Ubuntu repos and NodeSource) only allow one active version at a time, since they install to system paths. - How do I check which Node.js version is currently active on Ubuntu 26.04? Run
node --versionin your terminal. If you are using NVM, you can additionally runnvm currentto see which version NVM has activated, ornvm lsto see all installed versions with the active one highlighted. - Why does “node” not work after running “apt install nodejs” on Ubuntu 26.04? On older Ubuntu releases, the
nodejsbinary was sometimes installed asnodejsrather thannodedue to a naming conflict with a legacy package. On Ubuntu 26.04 this conflict is resolved, sonodeshould work directly after installation. If it does not, verify the installation withwhich nodejsand create a symlink if needed:sudo ln -s /usr/bin/nodejs /usr/local/bin/node. - Does the nodejs install on Ubuntu 26.04 include npm automatically? It depends on the method. When using NodeSource or NVM, npm is bundled with Node.js and installed automatically. When using the Ubuntu default repositories, you need to install npm separately with
apt install npmsince the Ubuntu repos package them independently.
Berita Terkini
Berita Terbaru
Daftar Terbaru
News
Jasa Impor China
Berita Terbaru
Flash News
RuangJP
Pemilu
Berita Terkini
Prediksi Bola
Technology
Otomotif
Berita Terbaru
Teknologi
Berita terkini
Berita Pemilu
Berita Teknologi
Hiburan
master Slote
Berita Terkini
Pendidikan
Resep
Jasa Backlink
Slot gacor terpercaya
Anime Batch
