118

on a Windows 10 machine and using nvm4w I tried:

from the above image:

  • node --version to check the current version
  • nvm list to list installed versions
  • nvm use 8.8.1 so we switch from 6 to 8
  • nvm on to enable it
  • node --version to re-check the node version

what am I doing wrong?

1
  • 4
    Check you have installed nodejs separately. Just uninstall nodejs from control panel it will start working Commented Jul 12, 2023 at 6:56

26 Answers 26

344

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 nvm is having trouble deleting this folder due to permission issues.

I have also experienced an issue where nvm seems to mix up the saved versions of node. For example it will save v14 in place of v16. In this case uninstall the version you wish to use using nvm uninstall {version} and then install it again using nvm install {version}.

9
  • 6
    nvm alias default {version} for linux
    – usersina
    Commented Oct 20, 2021 at 16:50
  • 6
    that's exactly the case, I just ran the powershell as Administrator then reused nvm and it worked ! Commented Dec 6, 2022 at 10:17
  • I have the same problem, when I enter the NVM USE but I am prompt with 2 exit status 1 error, and when I delete this one I am only prompt with one. I also read the same question from Github turns out there is a problem if there is a white space.
    – Biax20
    Commented Mar 6, 2023 at 0:01
  • 4
    on Mac you can use which node command to locate and delete the node coming not from nvm
    – e-shfiyut
    Commented May 14, 2023 at 8:47
  • 1
    respect tried thousands of thing finally found this solution.....thanks Commented Jun 22, 2023 at 13:24
73

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.

2
  • Effect answer, rename it and change version it will work. Commented May 13, 2023 at 14:21
  • 4
    renaming it means nvm will create a new folder at C:\Program Files\nodejs. To avoid confusion, get rid of the folder cause it's no longer needed.
    – E10
    Commented May 14, 2023 at 19:59
24

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
3
  • the question has some years, so I've evolved since 😉 - if you install nvm through chocolatey, all works out of the box... since I started to use Chocolatey, I have no issues with anything, even upgrading software is easy, and when there's the software you don't want to upgrade, you can pin them and they will never be upgraded 😁
    – balexandre
    Commented Dec 9, 2020 at 12:47
  • So what are you trying to do with these steps? "Installing, uninstalling, installing" does not make much sense to me lol; also note: I also use choco, powershell admin to install/use. never worked. Commented Feb 4, 2022 at 1:59
  • This worked. The problem for Windows are conflicts between the various node.js/nvm/yarn...
    – dcolazin
    Commented Mar 14, 2022 at 8:07
18

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.

1
  • My problem wasn't with nvm or brew eventually, the node version was coming from volta. But running which node as said here helped me find it quick and install right version with volta. Commented Sep 25, 2022 at 11:29
11

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.

1
  • and if nvm is not creating the folder nodejs ?? what should I do ?
    – elainr5
    Commented Sep 1, 2023 at 10:19
10

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

1
  • 1
    This should be the answer to this thread Commented May 8 at 4:55
5

I have tried to switch Node version using nvm but it is not reflecting so I deleted the folder inside c:/program files/nodejs enter image description here
after deleting the folder follow the same steps to switch the npm version using nvm and it will switch the node version.

1
  • This is very similar to the top answer. Can you explain the difference? Commented Mar 22, 2022 at 18:26
4

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.

0
4

First uninstall node if you installed it using windows installer, then install it using nvm again.

3

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.

3

Yet another answer because none of the others helped me.

Setup

  • Windows 11
  • Multiple accounts
  • Non-default install and symlink directories

I installed nvm using different directories than the default because this is necessary to avoid:

  • Issues due to spaces in the path
  • Issues when using nvm on two different accounts on the same machine

Solution

This solution works for any number of accounts on the same machine.

  1. Uninstall any nvm and nodejs you have.
  2. Make sure no directory from them remains (in Program Files, Program Files (x86) and any other place you might have tried installing nvm/nodejs)
  3. Reinstall nvm with:
    • An installation path that contains no spaces, and is not in any specific user's directory (e.g. C:\nvm)
    • A symlink path that contains no spaces, is not in any specific user's directory, and is not under nvm's directory (e.g. C:\nodejs)
  4. Open your shell as administrator, install your desired node version(s) (e.g. nvm install lts) and activate one (e.g. nvm use 18)
  5. Test that the version was activated correctly with nvm current and node --version
  6. Every time you change your node version with nvm use or install a new one with nvm install, do it in an administrator shell
3

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.

2

The steps I had to follow were:

  1. Uninstall node if there was an installation outside of nvm
  2. Ensure "C:\Program Files\nodejs" was deleted before installing nvm
  3. Install nvm which still fails to install node but from the errors it seems that's because its ultimately pointing at urls that have been decomissioned
  4. Use "nvm install NODE_VERSION" to install at least 2 versions of node which again fail as in 3)
  5. Download the versions of node I tried to install and unzip the entire contents to their respective %appdata%/nvm/vNode_version folders
  6. Use "nvm use NODE_VERSION" to switch between either version I've installed [but be careful... "npm -v" did not work until in visual studio until I closed and re-opened the program]

If anyone knows how to point nvm to the up to date urls, it'd be great to know. I suspect everything would work fine when running nvm from powershell run as administrator

1

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
1
  • which is not a powershell command...
    – MushyPeas
    Commented May 18, 2022 at 14:23
1

On Windows uninstalling Node.js at Control Panel > Programs > Uninstall a program, and letting nvm install the desired node versions also solves this issue.

1

In my case the things didn't work as described inside CI/CD service (TeamCity to be exact). I spent half a day, trying to find a solution and tried everything mentioned here and other similar questions. So, what worked:

  1. Perform a clean install of nvm (removing older standalone versions of nodejs fist), as specified by multiple other answers. Install node versions only using nvm.
  2. Make sure that process that is running your "nvm use" command has "Full Control" privilege to the root of nvm installation. So that it could delete the symbolic link "nodejs" folder when switching versions.
  3. Change a policy on your server to allow that same account creating symbolic links: enter image description here This point was, somehow, not mentioned by anyone anywhere, so it took me very long time to figure this out.
1

I just deleted nodejs folder from C drive and it work fine

1

One probable situation is that the NVM_SYMLINK directory doesn't exist.

In this case you should create it manually.

Check the NVM_SYMLINK directory:

nvm debug

the output like this:

NVM4W Version:      NVM_VERSION
NVM4W Path:         \NVM_HOME\nvm.exe
NVM4W Settings:     \NVM_HOME\settings.txt
NVM_HOME:           \NVM_HOME
NVM_SYMLINK:        \path\to\active-node\nodejs
Node Installations: \NVM_HOME
0

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.

0

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.

  1. open the path of nvm installation.

  2. open the setting.txt file and have a check with the path value.

  3. open the environment variables Control panel in Windows.

  4. check if it's the same between the value of NVM_SYMLINK in the system path and path in the setting.txt

  5. change two configuration to same values.

0

Mine was caused by EMSDK. which I set on my .zshrc to load it automatically. removed the emsdk related lines, and the node was following nvm.

0

I had this problem with Windows 10. I reinstalled nvm. and opened Command Prompt but after I wrote nvm use version it didn't work. then I closed and reopened Command Prompt. It was working.

0

I had the same problem, I realized I had forgotten to turn the NVM on, I turned it on and it started to work.

nvm on
0
0

If you had installed fnm, it would block nvm use. Just use fnm use for instead.

1
  • and "If" you would look at the dates, you would see this question was asked in 2017, where fnm is only available since 2019 🙃
    – balexandre
    Commented Nov 20, 2023 at 12:16
0

delete the folder located at C:\Program Files\nodejs

then in command prompt run nvm use {version}

-1

I was also having the issue where nvm use would say it was using the version I asked it to switch to, but then node -v said nothing changed. For me, which node brought two paths back, which was weird, because the base paths were the same. My home directory is /Users/stephene

which -a node
/Users/stephene/.nvm/versions/node/v14.15.5/bin/node
~/.nvm/versions/node/v10.24.1/bin/node

In ~/.bash_profile, I had

export NVM_DIR="~/.nvm"

I figured NVM was getting confused by the home file path reference, so I spelled it out for NVM by updating my .bash_profile

export NVM_DIR="/Users/stephene/.nvm"

and that fixed the problem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.