[Issue]: Doesn't function correctly when settings.txt isn't ascii format
iancward opened this issue · 2 comments
What happened?
We did the "noinstall" deployment method and generated settings.txt
with PowerShell. Apparently this caused the file to be generated with UTF-16LE, which is the default encoding by PowerShell.
Running nvm list
causes this issue:
nvm list
could not be found or does not exist. Exiting.
No installations recognized.
We had to convert settings.txt
to ascii
because even as UTF-8, it didn't work.
What did you expect to happen?
I expected that NVM should work. Although I understand that UTF-16LE isn't exactly a common (outside of PowerShell) encoding scheme.
Version
1.1.11 or newer (Default)
Which version of Windows?
Windows 10 (Default)
Which locale?
English (Default)
Which shell are you running NVM4W in?
PowerShell
User Permissions?
Administrative Privileges, Elevated
Is Developer Mode enabled?
None
Relevant log/console output
nvm list
could not be found or does not exist. Exiting.
No installations recognized.
### Debug Output
```Shell
PS C:\Windows\system32> nvm debug
could not be found or does not exist. Exiting.
Running NVM for Windows with administrator privileges.
Administrator:
Windows Version: 10.0 (Build 17763)
NVM4W Version: 1.1.12
NVM4W Path: C:\Program Files\nvm\nvm.exe
NVM4W Settings: C:\Program Files\nvm\settings.txt
NVM_HOME: C:\Program Files\nvm
NVM_SYMLINK: C:\Program Files\nodejs
Node Installations:
Total Node.js Versions: 0
Active Node.js Version: none
(run "nvm use <version>" to activate a version)
NVM_SYMLINK does not exist yet. This is auto-created when "nvm us
e" is run.
IPv6 is enabled. This can slow downloads significantly.
PROBLEMS DETECTED
-----------------
"Administrator: " is not an officially supported shell. Some fea
tures may not work as expected.
Find help at https://github.com/coreybutler/nvm-windows/wiki/Comm
on-Issues
### Anything else?
There are few possible related issues:
https://github.com/coreybutler/nvm-windows/issues/1107
https://github.com/coreybutler/nvm-windows/issues/1104
https://github.com/coreybutler/nvm-windows/issues/931
https://github.com/coreybutler/nvm-windows/issues/887
https://github.com/coreybutler/nvm-windows/issues/726
And a possibly related PR: https://github.com/coreybutler/nvm-windows/pull/1109
This is a "known issue", though your success with ASCII is a useful tidbit. UTF-8 was failing too. Normally I'd mark this as a duplicate, but I think this is an important point, so I'll keep this open until I can figure out a fix. There are some challenges with ASCII I'll need to think through.
In PowerShell, the >
operator effectively maps to Out-File
, so to work around this, we switched to | Out-File -Encoding ascii
.