Node Version Manager (NVM) is essential for any developer working with Node.js. It allows you to manage multiple active Node.js versions on a single system. This guide provides step by step instructions on how to install NVM on Linux, catering to some of the most common distributions. Additionally, we’ll include troubleshooting tips for frequent issues encountered during installation. 💡 This guide is only for Linux systems. Here are some links if you a looking for a more general guide on or just or . Prerequisites Before installing NVM on your Linux system, make sure you have: A standard Linux distribution such as Ubuntu, Debian, CentOS, or Fedora. Basic command line utilities installed. Access to a terminal. Sudo privileges for installing packages. Installing nvm on Linux Ubuntu/Debian: 1. Open your terminal. 2. Install curl or wget for downloading NVM installation script: 3. Download and install NVM by running: 4. Source your profile to add NVM to your path: Installing nvm on Linux CentOS/Fedora: 1. Open your terminal. 2. Install curl or wget: 3. Download and install NVM using curl: 4. Source your bash profile: Verify Installation After installation, you can verify that NVM is installed correctly by typing: You should see the version number of NVM displayed if the installation was successful. Common Troubleshooting Steps Installing NVM (Node Version Manager) on Linux typically goes smoothly, but there are a few common issues that you might encounter. Here’s a list of these potential problems along with solutions: 1. Command Not Found Error After Installation Problem: 😱 After installing NVM, when you try to use commands, you might encounter a error. Solution: 😎 This problem generally occurs if the NVM script isn't sourced in your shell profile file. To resolve it, add the following lines to your , , or whatever shell profile file you use: After adding these lines, reload your profile with (or the respective file), or restart your terminal. 2. Profile Script Not Executing on Terminal Launch Problem: 😱 NVM doesn't work automatically when you open a new terminal window, even after adding the necessary lines to your profile script. Solution: 😎 Ensure that your terminal is configured to launch a login shell, as some systems or terminal emulators don't do this by default. If using GNOME Terminal or another emulator, find the profile preferences or settings and ensure "Run command as a login shell" is checked. 3. Installation Errors Due to curl or wget Problem: 😱 The installation script fails to run due to issues with or . Solution: 😎 Make sure and are installed and up to date on your system. You can install them via your package manager, for example: Then, retry the installation using the curl or wget command. 4. Permission Issues During Installation Problem: 😱 The NVM installation script fails with permission denied errors. Solution: This can happen if your user does not have proper write permissions to the install directory or if trying to install without sufficient privileges. Run the script without sudo, but make sure your user owns the directory where NVM is being installed, usually your home directory. 5. Node Installation Fails After Installing NVM Problem: 😱 After installing NVM successfully, attempting to install Node versions results in errors. Solution: 😎 This could be due to network issues, or you might be behind a proxy. If it’s a proxy issue, configure npm to use the proxy: Also, ensure there are no network connectivity issues on your end. 6. NVM Slows Down Terminal Initialization Problem: 😱 After adding NVM to your profile script, the terminal starts up significantly slower. Solution: 😎 NVM can slow down terminal start up because it hooks into the shell startup script. To alleviate this, you can lazy load NVM or reduce the number of shell processes it initializes. There are community scripts and hacks that can help with lazy loading NVM, reducing its impact on shell startup time. 7. Conflicts with Existing Node or NVM Installations Problem: 😱 Conflicts arise if there are remnants of previous Node.js or NVM installations. Solution: 😎 Fully remove any existing Node.js installations ( and for Debian based systems) and NVM directories ( ). Then, try reinstalling NVM. These troubleshooting steps should help you address the most common issues encountered when installing NVM on Linux systems, ensuring a smoother setup process for managing Node.js versions. Installing NVM on Other Operating Systems While this guide focuses on Linux, it’s possible to install NVM on other operating systems as well: For macOS users, the installation steps are similar to those for Linux. More detailed instructions can be found in our . Windows users can use NVM Windows, a different variant suited for Windows environments. Check out our for more information. What is NVM? NVM stands for Node Version Manager. As its name implies, it helps you manage and switch between different Node versions with ease. It is partic