nvm-windows icon indicating copy to clipboard operation
nvm-windows copied to clipboard

"nvm could not be found" when user name has umlaut or non-ascii character

Open heneds opened this issue 3 years ago • 28 comments

Issue: After a fresh installation of nvm the application does not work but fails with the error message "C:\Users_USERNAME_\AppData\Roaming\nvm could not be found or does not exist. Exiting." This happens when USERNAME contains a non-ascii character. In the error message these characters are replaced with �.

How To Reproduce:

  1. Create or use an Windows account with umlauts or non-ascii characters in the user name (and more importantly in the name of the user folder)
  2. Install nvm.
  3. If the installer asks to handle an existing node installation, answer yes
  4. Run "nvm list"

Expected Behavior: Expecting to see a list of node versions.

Workaround: It works properly if you correct the path in settings.txt (while keeping the UTF-8 encoding)

Desktop: Windows 11

heneds avatar Jan 14 '22 09:01 heneds

Regarding the workaround: it's the "root" setting that needs correcting.

heneds avatar Jan 14 '22 09:01 heneds

Which version of NVM4W are you using? There appears to be an issue in older versions of Go that misinterpret umlauts and other western European characters. I'm unclear whether these issues are fully resolved in more recent versions of Go.

coreybutler avatar Jan 15 '22 16:01 coreybutler

I was using the latest version 1.1.9.

heneds avatar Jan 19 '22 19:01 heneds

I can't find the installer version but it was created on December 15 at ‏‎20:11:50.

heneds avatar Jan 19 '22 19:01 heneds

Thanks, v1.1.9 was created with Go 1.17, which is the latest stable release of Go. I'm unsure how to troubleshoot this at the moment since I do not have access to a German version of Windows. There is also a possibility this hasn't been fixed (or a reversion happened). I will look into this to the best of my ability, but I wouldn't count on an immediate resolution given the circumstance.

coreybutler avatar Jan 19 '22 19:01 coreybutler

+1 from me - same issue seems to have occurred with a colleague with a Ç in his last name trying to install v1.1.9. We have not attempted older versions.

The version of Windows does not seem to be the issue (I believe he too is running on an English install) - it seems to be merely the path to the install location, in this case the username part. If I understand correctly, this should be reproducable by creating a new user (either "online" / MS account, or offline) with one or more "special" characters like those mentioned in the username. But I could be mistaken =)

JakeRG avatar Feb 04 '22 10:02 JakeRG

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Mar 07 '22 01:03 github-actions[bot]

Not stale AFAIK. (Looks like #744 is a recent duplicate.)

heneds avatar Mar 07 '22 08:03 heneds

I didn't have this problem until after I upgraded to Windows 11 and upgraded NVM. It worked fine before upgrading to 1.1.9 but downgrading now doesn't help.

I got around this by opening C:\Users\Karl-JohanSjögren\AppData\Roaming\nvm\settings.txt and resaving the file as UTF8, so I'm guessing that it could have something to do with how the installer writes this file on Windows 11?

karl-sjogren avatar Mar 14 '22 17:03 karl-sjogren

@karl-sjogren thanks for sharing. It could be the installer, but it could also be Windows 11 not respecting the file encoding (which should be UTF8 by default). It's a little difficult to tell while Windows 11 keeps receiving updates.

It sounds like encoding is the problem regardless of whether the content is read from the settings file or displayed as an error message.

Go 1.18 was just released and it looks like there may be a fix. I'll try building the next maintenance release on this to see if it resolves @heneds original issue. As for the installer, it hasn't changed in years (and works on American English editions), so I suspect something is going on with the Windows 11 encoding. Regardless, I will look into this when I get a chance to build the next update.

coreybutler avatar Mar 18 '22 03:03 coreybutler

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 18 '22 02:04 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Apr 26 '22 02:04 github-actions[bot]

Having this same issue on Windows 11 and NVM 1.1.9 installed from Winget

eugeniomiro avatar May 30 '22 15:05 eugeniomiro

This wasn't supposed to be closed by the bot.

coreybutler avatar Jun 19 '22 20:06 coreybutler

@karl-sjogren thanks for sharing. It could be the installer, but it could also be Windows 11 not respecting the file encoding (which should be UTF8 by default). It's a little difficult to tell while Windows 11 keeps receiving updates.

It sounds like encoding is the problem regardless of whether the content is read from the settings file or displayed as an error message.

Go 1.18 was just released and it looks like there may be a fix. I'll try building the next maintenance release on this to see if it resolves @heneds original issue. As for the installer, it hasn't changed in years (and works on American English editions), so I suspect something is going on with the Windows 11 encoding. Regardless, I will look into this when I get a chance to build the next update.

I just experienced this on a newly installed nvm v1.1.9, Windows 10 pro (10.0.19044). Opened nvm\settings.txt and it was saved as ANSI encoding. Converting it to UTF8 as suggested by Karl fixed the issue.

Just wanted to give a second report of this as it happened on Windows 10 too.

noysom avatar Jun 20 '22 08:06 noysom

Can't we add the chcp 65001 > nul line to the nvm-windows/bin/install.cmd line 21 for saving files in UTF-8 format? If this isn't useful, please accept my apologies for wasting your time.

https://stackoverflow.com/questions/16598785/save-text-file-in-utf-8-encoding-using-cmd-exe

I only realized after @noysom 's message that I never mentioned that, afaik, my colleague who has this issue is also running on Windows 10 instead of 11.

We eventually worked around it by installing NVM in a different location (read; not the user directory, and thus avoiding having the non-ascii character in his username in the install path), as mentioned before.

[edit:] ... by 'before' I meant I could swear it was mentioned by someone else in this thread as a workaround. It seems I was mistaken as I can't find it. It was probably in one of the duplicate issue threads instead. So if anyone wanted to know another workaround that the "change encoding" one mentioned in here, there you go, just know I don't deserve the credit for it ;) [/edit]

JakeRG avatar Jun 29 '22 08:06 JakeRG

Same issue on Windows 10 Pro with a non-ascii username (Jørgen) image

image

PS C:\Users\Jørgen> nvm install lts
C:\Users\J�rgen\AppData\Roaming\nvm could not be found or does not exist. Exiting.
Downloading node.js version 16.16.0 (64-bit)...
Error while creating C:\Users\J�rgen\AppData\Roaming\nvm\v16.16.0\node.zip - open C:\Users\J�rgen\AppData\Roaming\nvm\v16.16.0\node.zip: The system cannot find the path specified.
Could not download node.js v16.16.0 64-bit executable.
PS C:\Users\Jørgen> nvm list
C:\Users\J�rgen\AppData\Roaming\nvm could not be found or does not exist. Exiting.

No installations recognized.

EDIT:

Found a workaround

Change the install folder to a filepath without non-ascii letters in it. I installed it to D:/nvm

EDIT 2:

I recommend changing your windows username to ASCII-only letters

Because this is a common issue with a lot of other apps as well, I opted to change my windows profile name instead. I recommend this for anyone who's reasonably tech-savvy, understand the risk and are willing to spend some time (1-2hrs) changing the username to save you from a lot of trouble down the line.

DISCLAIMER! Note that changing your username is not recommended by Microsoft, as it can mess up your operating system if you're not careful.

That said, here's some resources I used:

  • https://www.minitool.com/news/change-user-folder-name-windows-10.html
  • https://www.partitionwizard.com/partitionmagic/change-user-name-windows-10.html?_gl=1r2dob1_gaMTcxODM2MDY1NS4xNjcxMTk4ODcx_ga_W6RNX75Q2P*MTY3MTE5ODg3MS4xLjEuMTY3MTE5OTA1Mi4wLjAuMA..
  • https://answers.microsoft.com/en-us/insider/forum/all/change-local-user-account-name-in-windows-10/724d1a67-104c-49b4-bbaa-78135b317419

Snailedlt avatar Jul 18 '22 21:07 Snailedlt

Just ran into this as well and had to change the installation directory.

DennisRosen avatar Aug 01 '22 12:08 DennisRosen

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 01 '22 02:09 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Sep 09 '22 02:09 github-actions[bot]

Bot keeps closing this.

coreybutler avatar Nov 23 '22 01:11 coreybutler

Also happens with nvm v1.1.10 and Windows set to English. User name contains é character.

1898182 avatar Dec 01 '22 14:12 1898182

This issue also happens if the directory contains a space, however the workaround does not work.

LoboMetalurgico avatar Mar 01 '23 23:03 LoboMetalurgico

It has also happened to me on Windows 11 Pro, my username contains a ë character. The workaround has worked.

Adding it to the Documentation would be nice. I can do it if you want

GuillaumeNo avatar Mar 16 '23 09:03 GuillaumeNo

Same for me Windows 11 with Polish non ascii signs workaround with changing settings.txt to urf-8 encoding helped https://github.com/coreybutler/nvm-windows/issues/726#issuecomment-1067088011

tscislo avatar Nov 11 '23 20:11 tscislo

I didn't have this problem until after I upgraded to Windows 11 and upgraded NVM. It worked fine before upgrading to 1.1.9 but downgrading now doesn't help.

I got around this by opening C:\Users\Karl-JohanSjögren\AppData\Roaming\nvm\settings.txt and resaving the file as UTF8, so I'm guessing that it could have something to do with how the installer writes this file on Windows 11?

Happened to me today. This workaround fixed it.

➜ nvm -v
1.1.11

snerte avatar Dec 06 '23 08:12 snerte