Prerequisites For Mac
Before you begin, ensure that you have the following prerequisites installed on your system:
- Homebrew
Once above command executed run below
Now home brew is installed and ready to use.
Step 1: Installing NVM - Mac
To install NVM, open your terminal and execute one of the following commands
now create a .nvm directory using below command now create a file directory using below command Add below code in this file and save by pressing 'esc' key then keys : w q and hit enterStep 1: Installing NVM - Windows
Step 2: Verifying NVM Installation
You can verify that NVM is installed correctly by running the following command:
This should display the version of NVM you installed.Step 3: Installing Node.js Versions
Now that NVM is installed, you can easily install different Node.js versions using the following command:
Replace <node_version>
with the specific Node.js version you want to install, such as 14.17.6
or 16.5.0
.
Step 4: Using Specific Node.js Versions
NVM allows you to set a specific Node.js version as the default or use it in the current shell session:
To set a default version:
To use a specific version in the current session:
Step 5: Checking Node.js Version
You can always verify the currently active Node.js version by running:
Step 6: Switching Between Node.js Versions
One of the greatest benefits of NVM is the ability to switch between installed Node.js versions with ease. To switch to a different version, simply use the nvm use
command with the desired version.
With NVM, you have the flexibility to manage and switch between Node.js versions effortlessly, making it a valuable tool for any developer working on various projects.
In conclusion, Node Version Manager (NVM) is an essential tool for managing multiple Node.js versions on your system. Whether you're developing for different projects or ensuring compatibility with specific applications, NVM simplifies the process and empowers you to harness the full potential of Node.js. By following the steps outlined in this guide, you'll be well-equipped to manage your Node.js environments efficiently.
Thanks!