Actually you are trying to perform command of ubuntu/mac on windows.
If you want to install NVM in windows then please refer this step by step guide.
Step by step guide
NVM For Windows
Answer from Dakshesh Baldaniya on Stack OverflowVideos
Used the registry editor to add 2 new string varaibles to the regular user's profile. Can't do it through the Control Panel GUI because I'm always forced to use elevated credentials to access the control panel. And then when I do edit the User's environment vars, it's for the admin account only. So now when I open up a command window and run the "set" command, it includes these two variables:
NVM_HOME=C:\Users\<nonAdminUser>\AppData\Roaming\nvm
NVM_SYMLINK=C:\Program Files\nodejs
And now everything just works.
In my case it works without registry editing:
- Switch to admin account
- Go to nvm folder and add share it with user.
- Switch to user account.
- Add %NVM_HOME% and %NVM_SYMLINK% to user PATH variable
- Restart cmd.
First examine your actual "C:\Program Files\nodejs" directory. Most of us already have a "nodejs" directory from a prior install, before we decided (or were told) to install nvm.
In the end, this "C:\Program Files\nodejs" directory will actually be a shortcut to where nvm manages the versions it installs (see C:\Users\xxx\AppData\Roaming\nvm). It seems that nvm is simply switching the shortcut, when we call "nvm use ...".
Ok, so here is what I did to fix the situation where "nvm use ..." was not taking effect.
- Delete/remove/uninstall the version of node in your "C:\Program Files\nodejs" directory. To the point where there is no more "nodejs" directory at all.
- Delete the existence of nvm (C:\Users\xxx\AppData\Roaming\nvm), basically, manually delete the nvm dir.
- Download your desired version of nvm (https://github.com/coreybutler/nvm-windows/releases)
- Open a CMD prompt (run as administrator), and install the downloaded version of nvm, nvm-setup.exe, from within this CMD command prompt.
- From within the admin level command prompt, run "nvm install 7.2.1", or whatever node version you want to install. Probably you will be installing multiple versions, so repeat as needed.
- Now do the usual "nvm use ...", "nvm list", etc...
I dont know if this is the best way, but it worked for me...
Rename "C:\Program Files\nodejs" to "C:\Program Files\nodejsx"
nvm use x.x.x
This worked for me. Maybe it will work for you too.