DEV Community

Cover image for How to manage multiple Node JS versions?
Shubham Tiwari
Shubham Tiwari

Posted on

How to manage multiple Node JS versions?

Hello Everyone today I will show you how you can manage multiple Node Js version on a single System.

Let's get started...

What is the need for having multiple Node JS Version?

Well a few weeks ago I was working on a Project Created with JSP(Java Servlet Pages) and webpack, So the "SASS" node package has some dependency on other packages which is only supported in the old version of Node JS like v14, So I installed v14.16.0 and everything worked fine for that time But after few days when I was working with "Next JS" I have to use "SASS" node package but It only compiles the SASS code for Node JS v18+.
I can't install V18 because that JSP Project was still in progress.
There comes the saviour NVM(Node version Manager),with 1 line of command i could easily switch between multiple version of Node JS.

How to install NVM?

  • For Windows - https://github.com/coreybutler/nvm-windows/releases, go to this link and download the ".exe" file and install it.
  • For Mac and Linux - You can check some articles on how to install nvm as I am not familiar with Mac and Linux.
  • Once the installation is done, open your command prompt or VS Code terminal and run this command
nvm -v
Enter fullscreen mode Exit fullscreen mode
  • It will show you the nvm version if installed properly

How to install Multiple Node Js version?

  • To install any node js version just type this command with version number you want to install
nvm install <version_number>
Enter fullscreen mode Exit fullscreen mode
  • Example 1 - It will install the latest version
nvm install latest
Enter fullscreen mode Exit fullscreen mode
  • Example 2 - It will install the v14.16.0
nvm install 14.16.0
Enter fullscreen mode Exit fullscreen mode

If you want to delete any version just use this command

nvm uninstall <version_number>
Enter fullscreen mode Exit fullscreen mode

How to switch between different versions?

  • You can use this command to switch between different versions
nvm use <version_number
// Example
nvm use 14.16.0
Enter fullscreen mode Exit fullscreen mode
  • It will switch to version 14.16.0

How to check the installed Versions?

  • You can use this command to check how many versions are installed
nvm list
Enter fullscreen mode Exit fullscreen mode

THANK YOU FOR CHECKING THIS POST
You can contact me on -
Instagram - https://www.instagram.com/supremacism__shubh/
LinkedIn - https://www.linkedin.com/in/shubham-tiwari-b7544b193/
Email - shubhmtiwri00@gmail.com

^^You can help me with some donation at the link below Thank you👇👇 ^^
☕ --> https://www.buymeacoffee.com/waaduheck <--

Also check these posts as well
https://dev.to/shubhamtiwari909/website-components-you-should-know-25nm

https://dev.to/shubhamtiwari909/smooth-scrolling-with-js-n56

https://dev.to/shubhamtiwari909/swiperjs-3802

https://dev.to/shubhamtiwari909/custom-tabs-with-sass-and-javascript-4dej

Top comments (0)