nvm (Node Version Manager) is a tool used to download and install multiple Node.js versions.
npm (Node Package Manager) is a tool that allows you to install javascript packages.
Uninstall existing version of node since we won’t be using it anymore
Delete any existing nodejs installation directories.( e.g. “C:\Program Files\nodejs” OR C:\Program Files (x86)\nodejs ) that might remain. NVM’s generated symlink will not overwrite an existing (even empty) installation directory.
Delete the npm install directory at C:\Users[Your User]\AppData\Roaming\npm
We are now ready to install nvm. Download the installer from Here
Delete the existence of nvm (C:\Users\xxx\AppData\Roaming\nvm), basically, manually delete the nvm dir.
To upgrade, run the new installer. It will safely overwrite the files it needs to update without touching your node.js installations. Make sure you use the same installation and symlink folder. If you originally installed to the default locations, you just need to click “next” on each window until it finishes.
-
Download nvm for Windows
-
Choose nvm-setup.zip
-
Unzip & click on installer.
-
Check if nvm properly installed, In new command prompt type nvm.
-
Environment variable : Nodejs, Nvm and Npm installation directory path
- C:\Program Files\nodejs > Nodejs directory path
- C:\Users[Your User]\AppData\Roaming\nvm
- C:\Users[Your User]\AppData\Roaming\npm
-
Install node js using nvm : nvm install : The version can be a node.js version or "latest" for the latest stable version
-
check node version - node -v
-
(Optional)If you want to install another version of node js - Use STEP 5 with different version.
-
Check list node js version - nvm list
-
If you want to use specific node version do - nvm use
-
View remote available versions of Node.
$ nvm ls-remote
-
View local installed versions.
$ nvm ls
-
Install a specific version.
$ nvm install <version number>
-
Switch to a specific version of Node.
$ nvm use <version number>
-
Uninstall a specific version.
$ nvm uninstall <version number>
-
Displays the current running version of NVM for Windows.
$ nvm version
-
If you get error like npm/nvm/node not recognized as an internal or external command => follow step 4
-
"nvm use" doesn't Switch node version =>
- (Workaround) rename "C:\Program Files\nodejs" to "C:\Program Files\nodejsx"
Problem persist if nodejs directory exists, since nvm can not change it to a symlink and fails
- Open command prompt with administrator privilege, and then you can switch the version.
- (Workaround) rename "C:\Program Files\nodejs" to "C:\Program Files\nodejsx"
-
While executing
nvm install <version number>
command, error: Could not retrieve ..... => Trynvm proxy [url of your proxy server]
Please feel free to contribute to the project,create a pull request