nvm use does not switch node versions

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

I had to delete the folder located at C:\Program Files\nodejs:

enter image description here

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.


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.

Tags:

Nvm