nvm-windows: broken if username has space in it

Issue:

Most of the functionality is broken if the username has space in it, such as on, off, use and uninstall.

How To Reproduce:

  1. have space in username ( in one of my pcs, it’s Kd Puvvadi)
  2. Install 1.1.9 and upgrade to 1.1.10 or install 1.1.10
  3. run nvm use 16.18.1
$ nvm use 16.18.1
exit status 1: 'C:\Users\Kd' is not recognized as an internal or external command,
operable program or batch file.

exit status 1: 'C:\Users\Kd' is not recognized as an internal or external command,
operable program or batch file.
nvm uninstall 16.16.0
Uninstalling node v16.16.0...exit status 1: 'C:\Users\Kd' is not recognized as an internal or external command,
operable program or batch file.

Expected Behavior:

When using uninstall, it should uninstall the version and when using use it should switch the version

Desktop:

  • OS: Windows 10 Enterprise 22H2 19045.2251 Windows Feature Experience Pack 120.2212.4180.0
  • Shell: Powershell Core

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 9
  • Comments: 19 (1 by maintainers)

Most upvoted comments

Yes, bump, still broken. I installed fresh directly from repo downloads section. Windows default user folder is “fname lastname” iirc, so this is likely breaking the entire product for most users and should be considered a critical bug.

Edit: If you’re finding this and looking for a fast fix, 1.1.9 does work correctly.

Fix for windows

Just run your cmd as administrator and it should work

I think this is still an issue

Workaround:

# display short names:
# e.g. Oliver Mustermann -> OLIVER~1
dir C:\Users /X

# update path 
nvm root C:\Users\<Directory Shortname>\AppData\Roaming\nvm

This works instantly. I’m not sure if you manually need to update the NVM_HOME env vars in system properties. (search for: “environment”)

Is this using an official installer or something else (like winget)?

It’s directly from this repo.

You can install latest version in non-default location. This works for me.

ex. c:/nvm

We both sound stuck then… 😦

Given the choice between 1.1.10 that’s totally broken and 1.1.9 that just needs elevated privileges… 🤷

All users in our network don’t have elevated privileges, that would be deal breaker too.

yes, but downgrading versions made it work at all.

Given the choice between 1.1.10 that’s totally broken and 1.1.9 that just needs elevated privileges… 🤷

Downgrading to 1.1.9 here from the repo worked

@khill-fbmc problem with downgrading is, switching version needs elevated privileges.

I think it also might be broken if your name has an Å in it:

PS C:\code\Contracting\contracting-frontend> nvm install 16.13.1
C:\Users\M�rtenR�nge\AppData\Roaming\nvm could not be found or does not exist. Exiting.

But this path exists: C:\Users\MårtenRånge\AppData\Roaming\nvm

I use 1.10.0 downloaded from github releases

Same here. It should be fixed, or at least mentioned in the docs. 1.1.10 makes no difference. Workaround: https://stackoverflow.com/a/62376230/1650907