I have been facing this issue from last two days but couldn't use either nvm or node. Finally I could fix it. Follow below steps without missing any:
- Install nvm from here:
https://github.com/coreybutler/nvm-windows/releases
while installing
you will be asked to select the location of node,
leave it as it is.
You will be also asked to select the nvm location. Leave it as it is.
It is usually inside administrator:
C:\Users\administrator\AppData\Roaming\nvm
Remember that nvm installed inside administrator user. So other users can't access it.
- Once you install nvm. Check the system environment variables.
Make sure you have below two in your path:
NVM_HOME : C:\Users\administrator\AppData\Roaming\nvm
NVM_SYMLINK : C:\Program Files\nodejs
If they are not set then set the NVM_HOME and NVM_SYMLINK.
Now the nvm is installed. To verify it, if you open command prompt and enter the 'nvm list' command, it will not show up. Since it is installed under user administrator. This is very important.
- Now open the command prompt as - Run As Administrator.
Now enter the command and verify.
nvm list
If you have any node version already installed then that node version will show up.
16.17.0
Otherwise you can see that nothing is installed. Now enter the command to install a specific node version. Make sure you mention the arch(arch is 32-bit or 64 bit).
nvm install 14.16.1 64-bit
It will install the node version mentioned. It also installs the npm.
Now you can enter the command to verify the node installations list.
nvm list
Now, nvm is installed, node is installed and npm is also installed. However if you open VSCode terminal and enter the npm it may not work because of the permission issue.
To solve it:
Select the nodejs folder inside C:/Program Files
Right click and select the logged in user.
Give full permissions.
Now restart VSCode. and try the npm or node or nvm commands. All of them work seamlessly. I hope this is useful to someone.
Let me now if you got any issues in the process.
.