Multiple node versions on a windows machine [latest version]
There are some times you may need to run your Node JS project in different versions. Is it possible to accomplish this in a windows machine ?
The answer is YES. But we need a tool called NVM ( Node Version Manager ). Using NVM, it is possible to manage different version of a node project.
In this article I will help you to achieve this with simple steps.
Let’s dive into it before any further discussion… 🚀
Step1️⃣
- To install NVM on your windows machine visit it’s GitHub page here.
- There you will find detailed particulars about the package. Go ahead if you are a bookworm.
- Remember, NVM and NVM for windows are not the same. These are separate projects. NVM project is using in Linux/Mac machine.
- hence, here we will be discussing about NVM for windows.
Step 2 ( Installation )
- Before installing NVM, make sure any existing node versions are uninstalled. Otherwise, you will encounter version conflict.
- To uninstall current node version from your system please follow below path.
control panel => Programs and Feature => node
- once you find node in the list of software, double click on it to uninstall.
- some cases it is advised to check whether a node directory is still exist or not in the ProgramFiles folder even after uninstall is completed. If found, delete it right away.
- you can go to this directory by pressing Windows key + R then paste %ProgramFiles% into it.
- NVM can be installed either manually 🤯 or using windows installer
- I would recommend windows installer, because of less head ache 😊
- Once you go here windows installer ,you will find nvm-setup.zip file.
- click on it to download.
- once download is completed, go ahead and unzip the file.
- you will have nvm-setup application once unzip is completed.
- double click on it and follow the installation process as we install any other software.
- once installed you can employ multiple node versions using nvm install <version> command.
- I use command prompt to do this operation.
- NVM provides useful commands to play around. You can find those here.
- use NVM list command to check list of installed node versions.
- checkout to your preferred version using nvm use <version>.
- Always run command prompt with administrator privilege when using nvm use command to avoid error like ‘Access is denied’.
- Some times you not able to use command like npm i right after the installation of nvm.
- such cases, go to Edit the system environment variables, then, Environment Variables.
- under system variables select path.
- check path for NPM is correct or not. ( C:\Users\<User-name>\AppData\Roaming\npm )
- if it is correct delete and add it again. Then, Save and exit.
Note: This article is based on NVM for windows version 1.1.9. Installation guide might be different for future versions. So, always go through it’s documentation if you are installing a NVM version other than 1.1.9.
That’s all for this article
Would you like to learn JavaScript while scrolling through Instagram ? Then, I highly recommend to to follow my tech page here.
✅check out my previous articles on medium
Thank you 🙏