'nvm use does not switch node versions
on a Windows 10 machine and using nvm4w I tried:
from the above image:
node --version
to check the current versionnvm list
to list installed versionsnvm use 8.8.1
so we switch from 6 to 8nvm on
to enable itnode --version
to re-check the node version
what am I doing wrong?
Solution 1:[1]
I had to delete the folder located at C:\Program Files\nodejs
:
And then run nvm use {version}
again to repopulate this folder with the correct node version.
I suspect that in some cases nvm is having trouble deleting this folder for some reason.
Solution 2:[2]
So I found a workaround.
I renamed C:\Program Files\nodejs
to C:\Program Files\nodejsx
and then running nvm use versionNumber
works fine.
Seems like nvm cannot change it to a symlink and fails silently.
Solution 3:[3]
nvm works based on the fundamental idea of symlinks
. When a user is trying to hit the command nvm install <node_version>
the entered version of node is getting installed even if you have changed the C:\Program Files\nodejs
to C:\Program Files\nodejsx
.
If nvm fails to create the new folder C:\Program Files\nodejs
it will fail silently and you won't be informed.
You must manually check for the existence of the path C:\Program Files\nodejs
if it exits then delete the folder and change the node path in your environmental variables. This will help you to figure out the version of the npm command.
Solution 4:[4]
I was also facing the same issue.
I had node version 14.15.1
installed in my machine and had to use 12.16.1
I'm using Windows 10.
After installing 12.16.1
via nvm it was showing only this version in nvm list
and it wasn't showing current version in use.
Even after node use 12.16.1
the node -v
was still showing 14.15.1
.
Steps to resolve this issue:
- Uninstall Nodejs from control panel.
- Install Nodejs 12.16.1 using
nvm install 12.16.1
- Install Nodejs 14.15.1 using
nvm install 14.15.1
(or the version which got uninstalled) - Switch version using
nvm use 12.16.1
(change the version number accordingly)
Result:
C:\>nvm list
14.15.1
* 12.16.1 (Currently using 64-bit executable)
12.3.1
C:\>node -v
v12.16.1
Solution 5:[5]
Your problem can be solved by reinstalling the nvm version with Administrator privileges or just by renaming the folder C:\Program Files\nodejs
You can find further information here: https://github.com/coreybutler/nvm-windows/issues/67
Solution 6:[6]
This happens to be the issue till date and deleting nodejs folder does not work.
Just run nvm install using cmd as administrator
.
So even if you have downloaded nodejs from cmd without admin privilages, uninstall it and install again using cmd as admin.
This is what worked for me after trying almost every solution from github and stackoverflow.
Solution 7:[7]
1) Install NVM from the link : https://github.com/coreybutler/nvm-windows/releases.
2) Copy the settings.txt from the "C:\Users\YOUR_USERNAME\AppData\Roaming\nvm". to "C:\Users\ YOUR_USERNAME" 3) Restart your system for the changes to reflect. 4) Open the console and type below command : nvm list 5) To install the 6.9.3 version run the below command : nvm install 6.9.3 6) After the installation is complete it will add the node version in the nvm. To check the same type command : nvm list 7) To switch the command version type command below command : nvm use 6.9.3 To verify the node version switch type the command “node –v” 8) Its will display the node version in use.
For more details please check the below link : https://www.tutespace.com/2018/11/nvm-installation-on-windows.html
Let us know if you still face the same issue.
Solution 8:[8]
For me the problem (on Linux) was that I had installed node with Homebrew, and it was preventing the use of nvm. Before nvm could set up the correct symlink, I had to
brew uninstall node
I first found out about this situation by running
which node
This told me that node was being symlinked from Homebrew at
/home/linuxbrew/.linuxbrew/bin/node
instead of, as we want, from nvm at
/home/john/.nvm/versions...
As soon as "which node" reported that it was using the node from nvm, things were resolved for me.
Solution 9:[9]
I had the same problem.
My solution is that i uninstalled nodejs via chocolatey (the way i installed it) and then nvm worked again.
After checking the nodejs folder in C:/Program Files i noticed that nvm probably works via creating a link/shortcut to the nvm folder where the different versions of nodejs are stored. That´s the way the "Path" and everything works.
I hope that helped.
Solution 10:[10]
I have tried to switch Node version using nvm but it is not reflecting so I deleted the folder inside c:/program files/nodejs
after deleting the folder follow the same steps to switch the npm version using nvm and it will switch the node version.
Solution 11:[11]
Follow this step
1.delete node and npm in path
To Find Path
which node
output
/c/Users/balaji/AppData/Roaming/npm/node
which npm
output
/c/program files/node.js
2.To list out version
nvm list
3.set node
nvm use version
To know remote version
nvm list available
To know local version
nvm list
Solution 12:[12]
None of the above helped in my case. I could see the symlink was created and correct but NVM4W would still not "use" the correct version. The node version I had installed with NVM was not compatible with my version of Windows.
When you run "nvm ls" or "nvm current", it calls GetCurrentVersion() which runs "node -v" in the command line. If that output is anything other than the current version, such as the warning that you are running an incompatible OS, it will fail to indicate the currently selected version. It does so in a way that is not obvious why "nvm use x" did not work.
You can bypass the node OS check with an environment variable (node version >=14 as far as I could find): How to set the NODE_SKIP_PLATFORM_CHECK environment variable to 1 which skips the version check Though you may need to update Windows or use an earlier version of node if node doesn't function as expected.
With that set, "nvm use" functioned as expected.
Solution 13:[13]
I met this problem this morning. And I think the reason for the problem is that it's different between the nvm's settings and env configuration. I solved it the following way.
open the path of nvm installation.
open the setting.txt file and have a check with the path value.
open the environment variables Control panel in Windows.
check if it's the same between the value of
NVM_SYMLINK
in the system path andpath
in the setting.txtchange two configuration to same values.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow