Ubuntu is a popular Linux distribution known for its user-friendly interface and robust performance. If you're a developer or someone interested in setting up Node.js on your Ubuntu system, you're in the right place. In this updated 2026 guide, we will walk you through the process of installing NVM (Node Version Manager) on Ubuntu. NVM is a fantastic tool that allows you to manage multiple Node.js versions effortlessly, making it an essential part of any developer's toolkit.
Table of Contents
- Introduction
- Prerequisites
- Installing NVM
- Verifying NVM Installation
- Installing Node.js with NVM
- Switching Between Node.js Versions
- Installing Global npm Packages
- Troubleshooting NVM
- Uninstalling NVM
- Conclusion
1. Introduction
In this section, we'll introduce you to Ubuntu and NVM, providing an overview of why NVM is indispensable for Node.js developers.
2. Prerequisites
Before diving into the installation process, we'll outline the prerequisites you need to have in place for a smooth experience.
3. Installing NVM
Step-by-step instructions on how to download and install NVM on your Ubuntu system.
4. Verifying NVM Installation
Learn how to check if NVM is correctly installed on your system and confirm its version.
5. Installing Node.js with NVM
Now that NVM is set up, we'll guide you through the process of installing Node.js and managing its versions.
6. Switching Between Node.js Versions
Discover how to switch between different Node.js versions effortlessly with NVM.
7. Installing Global npm Packages
Learn how to install global npm packages that can enhance your development workflow.
8. Troubleshooting NVM
We'll cover common issues and their solutions to ensure your NVM experience is trouble-free.
9. Uninstalling NVM
If you ever need to remove NVM from your system, we'll guide you through the uninstallation process.
10. Conclusion
A summary of what you've learned in this guide and why mastering NVM is essential for Ubuntu users.
Installing NVM on Ubuntu: A Step-by-Step Guide (2026)
1. Introduction
Ubuntu is a widely-used Linux distribution, known for its simplicity and user-friendliness. For developers, Ubuntu provides an excellent platform to build and run applications. Node.js, a popular JavaScript runtime, is often used for developing server-side applications, and to manage Node.js versions, we turn to NVM (Node Version Manager).
2. Prerequisites
Before you embark on this NVM installation journey, ensure you have the following:
- A machine running Ubuntu (of course!)
- Access to the terminal with administrative privileges
- A basic understanding of the Linux command line
- A stable internet connection to download NVM and Node.js
3. Installing NVM
Now, let's get to the heart of the matter – installing NVM on your Ubuntu machine. Open your terminal and follow these steps:
Update your package list to make sure you have the latest information about available packages:
sudo apt updateInstall the necessary dependencies:
sudo apt install curl gitDownload and install NVM using curl. As of 2026, the current stable release is v0.40.6 — always check the official releases page for the latest version before installing:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.6/install.sh | bashClose and reopen your terminal to start using NVM. You can also run the following command to apply the changes without restarting:
source ~/.bashrcNote: depending on your shell, you may need to source
~/.zshrc or ~/.profile instead. The install script tells you exactly which file it updated.4. Verifying NVM Installation
To ensure that NVM is successfully installed, run the following command:
nvm --versionThis command should display the installed NVM version (e.g.
0.40.6).5. Installing Node.js with NVM
Now that NVM is at your service, installing Node.js is a breeze. Use the following command to install the latest LTS (Long Term Support) version of Node.js:
nvm install --lts6. Switching Between Node.js Versions
Managing multiple Node.js versions is where NVM truly shines. To switch between installed versions, use the following command, replacing <version> with the desired version number:
nvm use <version>You can also list every version currently installed on your machine at any time:
nvm ls7. Installing Global npm Packages
Global npm packages can enhance your development workflow. To install them, simply use the "npm install -g" command followed by the package name.
For example, to install the popular package "nodemon", you would run:
npm install -g nodemonKeep in mind that global packages are installed per Node.js version managed by NVM — if you switch to a different version with
nvm use, you'll need to reinstall global packages for that version too.8. Troubleshooting NVM
Encountering issues with NVM? Don't worry; we've got you covered. Check out these common troubleshooting tips:
- Ensure your system meets the prerequisites mentioned earlier.
- Double-check your internet connection; sometimes, slow or interrupted downloads can cause problems.
- If you encounter permission issues, avoid running nvm commands with sudo — NVM installs into your home directory and is designed to work without elevated privileges; using sudo can actually create permission conflicts later.
- If
nvmisn't recognized after installation, double-check that the source line was added to your shell config file and that you've reopened the terminal or re-sourced the file. - For more detailed troubleshooting, refer to the official NVM documentation.
9. Uninstalling NVM
Should you ever need to remove NVM from your system, follow these steps:
1. Remove NVM and all installed Node.js versions:
nvm deactivate
nvm uninstall --all2. Remove the NVM directory:
rm -rf ~/.nvm3. Remove NVM-related lines from your shell configuration file (e.g., "~/.bashrc" or "~/.zshrc").
10. Conclusion
Congratulations! You've mastered the art of installing and managing Node.js versions on your Ubuntu system using NVM. This powerful tool allows you to switch seamlessly between Node.js versions, ensuring compatibility with your projects. As NVM and Node.js continue to release new versions, always check the official NVM releases page before installing to make sure you're using the current stable script.