Open DanKaplanSES opened 2 months ago
I didn't even know there was a windows version of curl.
If it's possible for nvm to determine that's the version in use - or better, to feature-test for whatever's not working the same as real curl - then nvm can certainly check for that.
Alternatively, if there's a fix we can make that allows it to work in this scenario, that's ideal.
Unfortunately I'm not sure how this could be tested without your precise setup - in CI or on my end.
This wasn't immediately obvious to me so I wanted to add an explanation of the cause. This is the warning:
$ nvm install 20
Downloading and installing node v20.15.1...
Downloading https://nodejs.org/dist/v20.15.1/node-v20.15.1-win-x64.zip...
Warning: Failed to open the file
Warning: /home/MYUSER/.nvm/.cache/bin/node-v20.15.1-win-x64/node-v20.15.1-win-
Warning: x64.zip: No such file or directory
curl: (23) Failure writing output to destination, passed 16384 returned 4294967295
What's happening is cygwin is using Windows's curl
command, and it's telling the command to download the file to /home/MYUSER/.nvm/.cache/bin/...
. But that's a cygwin path that Windows (and by extension, Windows's curl
command) doesn't understand. Windows paths start with a drive letter, e.g., C:\a\b\c\...
.
if there's a fix we can make that allows it to work in this scenario, that's ideal.
If there were plans to get nvm
running on cmd.exe or powershell, I would agree, but in my opinion, it would be better to error early and force the user to use a posix(-like) curl command. I think in most cases, using the Windows curl would be accidental, and attempting to recover from a human error may mislead the user and their understanding of their own environment.
You were okay with either solution, but I am interested in getting a better understanding of your thoughts on the matter, because it may help me level up my philosophy.
I agree with you; the only way just using windows’ curl is viable is if it can reliably convert the Cygwin path to a Windows path, or, if we could use the windows curl to download to a windows temp dir, and then move it to a Cygwin path.
If it can’t be done right, then an early error is indeed best.
Operating system and version:
Windows 10
nvm debug
output:nvm ls
output:How did you install
nvm
?What steps did you perform?
What happened?
In cygwin, the curl command is optional and if it's not installed, cygwin falls back to the windows curl command. The script installs even when using the windows curl. The problem happens later when
nvm install <x>
is used:What did you expect to happen?
I expected node v20.15.1 to download and install successfully.
My feature request: I would like the script to fail with a helpful error when using the Windows curl command. Without one, it's difficult to troubleshoot this error due to a couple of red herrings:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
succeeds, suggesting that curl isn't the issue.Warning: /home/MYUSER/.nvm/.cache/bin/node-v20.15.1-win-x64/node-v20.15.1-win-
) suggests this could be a CRLF/LF line ending issue.Is there anything in any of your profile files that modifies the
PATH
?.bash_profile
: