Loading image

Blogs / Technology

Node Version Manager (NVM) Install Guide: Windows, Linux, and macOS

Node Version Manager (NVM) Install Guide: Windows, Linux, and macOS

  • showkat ali
  • 0 Comments
  • 566 View

 

Node Version Manager (NVM) is a powerful tool that allows developers to easily manage multiple versions of Node.js and npm on their machines. Whether you're working on different projects that require specific Node.js versions or just want to experiment with the latest features, NVM makes it simple to switch between versions without any hassle. In this guide, we’ll walk you through the installation process for WindowsLinux, and macOS.


 

What is NVM?

NVM stands for Node Version Manager. It’s a command-line tool that lets you:

 

 

  • Install multiple versions of Node.js and npm.
  • Switch between different Node.js versions with a single command.
  • Set a default Node.js version for your projects.
  • Avoid conflicts between projects that require different Node.js versions.

Why Use NVM?

  • Flexibility: Easily switch between Node.js versions for different projects.
  • No Conflicts: Avoid global installation issues by managing versions locally.
  • Easy Updates: Quickly test new Node.js versions without affecting your existing setup.
  • Cross-Platform: Works on Windows, Linux, and macOS.

How to Install NVM on Windows, Linux, and macOS

Below are step-by-step instructions for installing NVM on each operating system.


1. Installing NVM on Linux and macOS

Step 1: Open Your Terminal

On Linux or macOS, open your terminal. You can use the default terminal or any terminal emulator like iTerm2 (macOS) or GNOME Terminal (Linux).

 

Step 2: Install NVM

Run the following command to download and install NVM:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash

This script clones the NVM repository to ~/.nvm and adds the necessary configuration to your shell profile (~/.bashrc, ~/.zshrc, or ~/.profile).

 

Step 3: Reload Your Shell

After installation, reload your shell configuration:

source ~/.bashrc  # For Bash

source ~/.zshrc   # For Zsh

 

Step 4: Verify the Installation

Check if NVM is installed correctly:

nvm --version

If you see a version number (e.g., 0.39.5), NVM is ready to use!


2. Installing NVM on Windows

On Windows, NVM is not natively supported, but you can use nvm-windows, a similar tool designed for Windows.

Step 1: Download nvm-windows

  1. Go to the nvm-windows GitHub repository.
  2. Download the latest installer (nvm-setup.exe).

Step 2: Run the Installer

  1. Open the downloaded nvm-setup.exe file.
  2. Follow the installation wizard:
    • Accept the license agreement.
    • Choose the installation path (default is fine).
    • Set the Node.js symlink path (default is fine).

Step 3: Verify the Installation

Open a new Command Prompt or PowerShell window and run:

nvm --version

If you see a version number, NVM is installed successfully.


3. Using NVM to Manage Node.js Versions

Now that NVM is installed, let’s see how to use it to install and manage Node.js versions.

Install a Specific Node.js Version

To install a specific version of Node.js (e.g., 18.0.0), run:

nvm install 18.0.0

Install the Latest Node.js Version

To install the latest stable version of Node.js, run:

nvm install node

Switch Between Node.js Versions

To switch to a different installed version, use:

nvm use 18.0.0

Set a Default Node.js Version

To set a default version for all new terminal sessions, run:

nvm alias default 18.0.0

List Installed Node.js Versions

To see all installed versions, run:

nvm ls

Uninstall a Node.js Version

To remove a specific version, use:

nvm uninstall 18.0.0

4. Troubleshooting Common Issues

NVM Command Not Found

If you get a command not found error after installing NVM:

  • Ensure you reloaded your shell (source ~/.bashrc or source ~/.zshrc).
  • Check if the NVM script was added to your shell profile file.

Permission Denied Errors

On Linux/macOS, if you encounter permission issues, try running commands with sudo or adjust file permissions.

Windows Symlink Issues

If you face Symlink issues on Windows, ensure you ran the installer as an administrator.


5. Why NVM is a Developer’s Best Friend

NVM simplifies Node.js version management, making it easier to:

  • Test new features in the latest Node.js versions.
  • Maintain compatibility with older projects.
  • Avoid conflicts between global and local installations.

Whether you’re a beginner or an experienced developer, NVM is a must-have tool in your development toolkit.


Conclusion

Installing NVM is a straightforward process that unlocks the flexibility to manage multiple Node.js versions effortlessly. Whether you’re on Windows, Linux, or macOS, this guide has you covered. Once installed, you’ll wonder how you ever lived without it!

Got questions or stuck somewhere? Drop a comment below, and I’ll be happy to help!


Happy Coding! 🚀

 

 

 

  • Technology
showkat ali Author

showkat ali

Greetings, I'm a passionate full-stack developer and entrepreneur. I specialize in PHP, Laravel, React.js, Node.js, JavaScript, and Python. I own interviewsolutionshub.com, where I share tech tutorials, tips, and interview questions. I'm a firm believer in hard work and consistency. Welcome to interviewsolutionshub.com, your source for tech insights and career guidance.

0 Comments

Post Comment

Recent Blogs

Recent posts form our Blog

How to Use Summernote in React.js: A Simple Guide

How to Use Summernote in React.js: A Simple Guide

showkat ali
/
Programming

Read More
Fetch API vs. Axios: A Comparison of the Best Option for HTTP Requests

Fetch API vs. Axios: A Comparison of the Best Option for HTTP Requests

showkat ali
/

Read More
Advancements in 5G Technology

Advancements in 5G Technology

Arman Ali
/
Programming

Read More
how to get value from quill editor : A Clear and Simple Guide

how to get value from quill editor : A Clear and Simple Guide

showkat ali
/
Programming

Read More
How to Use Summernote Editor in Laravel 10?

How to Use Summernote Editor in Laravel 10?

showkat ali
/
Programming

Read More
Understanding Recursive Functions in Python: A Deep Dive

Understanding Recursive Functions in Python: A Deep Dive

showkat ali
/
Programming

Read More