nvm-windows: Getting "exit status 1: 'C:\Program' is not recognized as an internal or external command" when switching versions

I have installed v1.1.0 in “C:\Program Files\nvm”. All good but when I’m trying to switch to a version I have installed I get:

C:\WINDOWS\system32>nvm use 5.10.1
exit status 1: 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 47
  • Comments: 26 (1 by maintainers)

Most upvoted comments

The problem is with the spaces in URL(C:\Program Files). Try to install the nvm directly in C:/ or in other folder without spaces in the PATH.

a better solution is : https://github.com/coreybutler/nvm-windows/issues/405

Open Cmd, go to the Users directory, type dir /x and you will see the shortened version of the name of the users. (ALEXKA~1 in my case) Inside the nvm installation (AppData\Roaming\nmv in my case) there is a settings file, edit the first line and instead of having the space name put that shortened version and leave the rest the same like this : root: C:\Users\ALEXKA~1\AppData\Roaming\nvm

Change root directory for version of nodes (without spaces) Then You can install there node and use it Example: nvm root C:\nodejs\nvm nvm install 10.0.0 nvm use 10.0.0

Issue is old but for anyone that lands here you can reinstall nvm as mentioned above, Or use short path. Changing C:\Program Files\nvm with nvm root C:\PROGRA~1\nvm Might also want to use shortPath for NVM_SYMLINK : C:\Program Files\nodejs to C:\PROGRA~1\nodejs

One of my users is having the same problem. However, moving nvm to another folder doesn’t work for us, because our security policies don’t allow us to run applications outside of Program Files or Program Files (x86) folders. It would be helpful if the code allowed it to run in a directory with spaces.

So if I put a space in my name when I got the computer, I’m just screwed forever, huh?

windows

move to path there without whitespace

or

running cmd as administrator
and then mklink it to the new path there without whitespace.

If you manually move the nvm folder to for instance to C:\nvm you will need to:

Update the environment variable(NVM_HOME, both user and system ENV variables) so that your terminal recognizes the new location:

Once the environment variables are updated and you restart your terminal/command prompt, nvm should work, but the settings are still attached to the previous location, which will cause an error if you attempt to nvm list or mostly any other command.

Running nvm root will show that old location, all you have to do is set it with nvm root C:\nvm (given the location you updated it to was C:\nvm, which is the same location you set the environment variable to).

Otherwise you will get errors saying that nvm is referencing the old path.

UPDATE:

once that is done your symlink is now corrupt C:\Program Files\nodejs variable NVM_SYMLINK.

You have to manually update the symlink by right-clicking the properties(of the symlink at: C:\Program Files\nodej) and specifying the location of an executable node, which is where you moved it: C:\nvm\v6.11.3 and select the executable node file.

then restart the terminal/cmd and nvm off and nvm on and it will work, you will see if you issues the nvm list command:

  • 6.11.3 (Currently using 64-bit executable) (given that 6.11.3 is the version you have)

That was not fun.

Spacing in the path is the problem

you can run

nvm root and find the root folder

then copy the contents to another folder without any spaces on the path

after that move the nvm root to that folder by running the command below (with full path)

nvm root [path]

You have changed the default path during installation. I uninstalled nvm, and installed it with default paths, all works fine.

Yes, but that is 😃).