DEV Community

Cover image for HOW TO INSTALL NVM ON WINDOWS
fisayo~
fisayo~

Posted on

HOW TO INSTALL NVM ON WINDOWS

If you find yourself at a crossroads, wondering how to seamlessly manage different Node.js versions, worry not - I'm here to guide you through the installation process of NVM (Node Version Manager). NVM is a tool that allows you to easily manage multiple installations of node.js on a single machine. It is useful for developers who work on projects with different node versions required.

NVM is different from NPM in that NPM is for managing different packages or libraries of different JavaScript code written by other developers.


INSTALLING NVM FOR WINDOWS

Before diving into NVM, ensure you uninstall any existing Node.js versions to prevent conflicts with the upcoming NVM installation.

  1. Clear your terminal to create a clean slate. This ensures a smooth space for NVM installation.

  2. Navigate to the NVM for Windows repository on github to download the nvm installer. In the assets folder click the file that reads 'nvm-setup.exe'

a picture showing the nvm github repo showing the assets folder

This initiates the download of the latest version of nvm to your machine.

  • 3. Once installed, open a new terminal and confirm the successful installation by typing in the command:
nvm -v
Enter fullscreen mode Exit fullscreen mode

This command should display the version number of the latest NVM you installed.

USING NVM TO SWITCH BETWEEN NODE VERSIONS

Now that NVM is at your disposal, let's explore its power to effortlessly manage various Node.js versions for diverse projects.


  1. Upon NVM installation, you can:

a. Run your project on the new terminal to confirm the required node version (an error indicating the required Node.js version will definitely be displayed) OR

b. In the package.json file, under dependencies, look for '@types/node'. This usually indicates the node version required for the project.

Screenshot of package.json file

Now that you know the version required, you can install it by running the command:

nvm install <specified_version>
Enter fullscreen mode Exit fullscreen mode

For instance, if the project needs version 16.14.0:

nvm install 16.14.0
Enter fullscreen mode Exit fullscreen mode

  • 2. Receive confirmation with the "Installation complete" message. To switch to the installed version, type in the command:
nvm use 16.14.0
Enter fullscreen mode Exit fullscreen mode

  • 3. Effortlessly manage your Node.js versions by checking the installed ones with this command:
nvm list
Enter fullscreen mode Exit fullscreen mode

Conclusion

Embrace the convenience of NVM - install different versions as per project requirements, seamlessly switch between them, and bid farewell to storage congestion and the tedious cycle of downloading and uninstalling. NVM is your gateway to efficient Node.js version management.

For further contributions or any questions, feel free to connect with me on Twitter. Until next time, happy coding!

Top comments (0)