Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git on windows can’t clone nvm test filenames #1643

Closed
isomorphisms opened this issue Oct 28, 2017 · 46 comments
Closed

git on windows can’t clone nvm test filenames #1643

isomorphisms opened this issue Oct 28, 2017 · 46 comments

Comments

@isomorphisms
Copy link

  • Operating system and version:
    windows 10

  • nvm debug output:
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 12492 100 12492 0 0 10658 0 0:00:01 0:00:01 --:--:-- 10658
    => Downloading nvm from git to '/c/Users/CJ/.nvm'
    => Cloning into 'C:/Users/CJ/.nvm'...
    remote: Counting objects: 263, done.
    remote: Compressing objects: 100% (228/228), done.
    remote: Total 263 (delta 31), reused 108 (delta 25), pack-reused 0 eceivin
    Receiving objects: 100% (263/263), 116.01 KiB | 2.97 MiB/s, done.
    Resolving deltas: 100% (31/31), done.
    Note: checking out 'b546436113084d6de584c57b259b947dd467a900'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

error: unable to create file test/fast/Aliases/"nvm alias" should not accept aliases with slashes: Invalid argument
error: unable to create file test/fast/Aliases/"nvm unalias" should not accept aliases with slashes: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias " again should change the target: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias " should list but one alias.: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias" lists implicit aliases when they do not exist: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias" lists manual aliases instead of implicit aliases when present: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias" should list all aliases.: Invalid argument
error: unable to create file test/fast/Aliases/lts/"nvm alias" should ensure LTS alias dir exists: Invalid argument
error: unable to create file test/fast/Listing paths/Running "nvm which 0.0.2" should display only version 0.0.2.: Invalid argument
error: unable to create file test/fast/Listing paths/Running "nvm which foo" should return a nonzero exit code when not found: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls 0.0.2" should display only version 0.0.2.: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls 0.2" should display only 0.2.x versions.: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls foo" should return a nonzero exit code when not found: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls io" should return NA: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls node_" should return a nonzero exit code when not found: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls stable" and "nvm ls unstable" should return the appropriate implicit alias: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls system" should include "system" when appropriate: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should display all installed versions.: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should filter out ".nvm": Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should filter out "versions": Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should include "system" when appropriate: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should list versions in the "versions" directory: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" with node-like versioning vx.x.x should only list a matched version: Invalid argument
error: unable to create file test/fast/Running "nvm alias" should create a file in the alias directory.: Invalid argument
error: unable to create file test/fast/Running "nvm current" should display current nvm environment.: Invalid argument
error: unable to create file test/fast/Running "nvm deactivate" should unset the nvm environment variables.: Invalid argument
error: unable to create file test/fast/Running "nvm install" with "--reinstall-packages-from" requires a valid version: Invalid argument
error: unable to create file test/fast/Running "nvm install" with an invalid version fails nicely: Invalid argument
error: unable to create file test/fast/Running "nvm unalias" should remove the alias file.: Invalid argument
error: unable to create file test/fast/Running "nvm uninstall" should remove the appropriate directory.: Invalid argument
error: unable to create file test/fast/Running "nvm uninstall" with incorrect file permissions fails nicely: Invalid argument
error: unable to create file test/fast/Running "nvm unload" should unset all function and variables.: Invalid argument
error: unable to create file test/fast/Running "nvm use foo" where "foo" is circular aborts: Invalid argument
error: unable to create file test/fast/Running "nvm use iojs" uses latest io.js version: Invalid argument
error: unable to create file test/fast/Running "nvm use system" should work as expected: Invalid argument
error: unable to create file test/fast/Running "nvm use x" should create and change the "current" symlink: Invalid argument
error: unable to create file test/fast/Running "nvm use x" should not create the "current" symlink if $NVM_SYMLINK_CURRENT is false: Invalid argument
error: unable to create file test/slow/Running "nvm current" should display current nvm environment.: Invalid argument
error: unable to create file test/slow/nvm exec/Preamble works and respects "silent" flag: Invalid argument
error: unable to create file test/slow/nvm exec/Running "nvm exec --lts" should work: Invalid argument
error: unable to create file test/slow/nvm exec/Running "nvm exec 0.x" should work: Invalid argument
error: unable to create file test/slow/nvm exec/Running "nvm exec" should pick up .nvmrc version: Invalid argument
error: unable to create file test/slow/nvm reinstall-packages/Running "nvm copy-packages $(nvm ls current)" should error out: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run --harmony --version" should work: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run --lts" should work: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run 0.x" should error out sensibly when 0.x is not installed: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run 0.x" should work: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run" should pick up .nvmrc version: Invalid argument
error: unable to create file test/slow/nvm uninstall/Running "nvm uninstall 0.12.6" uninstalls v0.12.6: Invalid argument
error: unable to create file test/slow/nvm uninstall/Running "nvm uninstall" with incorrect file permissions fails nicely: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use --lts" uses latest LTS version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use --lts=foo" uses latest "foo" LTS version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use iojs" uses latest io.js version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use node" uses latest stable node version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use v1.0.0" uses iojs-v1.0.0 iojs version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use" calls "nvm_die_on_prefix": Invalid argument
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Failed to clone nvm repo. Please report this!

  • nvm ls output:
  • How did you install nvm? (e.g. install script in readme, homebrew):

  • What steps did you perform?

  • What happened?

  • What did you expect to happen?

  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?

  • If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?
@ljharb
Copy link
Member

ljharb commented Oct 29, 2017

What does type git and git --version output?

@ljharb
Copy link
Member

ljharb commented Oct 29, 2017

Ah, you're on Windows - are you using BashOnWindows? What shell are you using?

@lamuertepeluda
Copy link

I have the same problem with zsh on BashOnWindows (WSL/Ubuntu from Windows Store, Windows 10 Fall Creators Update). I'm not able to install nvm, nor to checkout a previous commit since this test is automatically starting (and failing).

@ljharb
Copy link
Member

ljharb commented Nov 7, 2017

I'm confused; BashOnWindows is bash - you can run zsh on windows?

@lamuertepeluda same question for you :-)

@lamuertepeluda
Copy link

@ljharb here's the output

$ type git
git is /usr/bin/git
$ git --version
git version 2.7.4

And yes, now you can use the shell you prefer on WSL (Windows Subsystem for Linux), and I opted for zsh + oh-my-zsh since they increase my productivity a lot on my Mac and Linux setups.
I'm not 100% sure if WSL == BashOnWindows.

In case you are interested, I followed these two interesting guides:

  1. How to install zsh and oh-my-zsh on Windows 10
  2. Set and use Zsh as default shell in WSL on Windows 10 the right way

I am trying to get rid of git-bash, cygwin and nvm-windows which, although they are great softwares for what they aim to do, have some limitations. My hope is that WSL has a more "linuxish" experience since it's easier for me to deal with dev stuff on Linux.

That said, this page and this other page say nvm is supported by WSL, using the standard way of installation with curl/wget.

@ljharb
Copy link
Member

ljharb commented Nov 8, 2017

fwiw, omz breaks a ton of things :-/ it's the biggest cause of complexity in nvm.

nvm should definitely work on BashOnWindows or on WSL, as long as you're using a POSIX-compliant shell.

This specific issue, however, appears to be some kind of incompatibility with the git clone operation performed by the install script.

Can you try git cloning this repo directly on the command line? What happens if you check out the master branch, or the latest git tag?

@lamuertepeluda
Copy link

lamuertepeluda commented Nov 8, 2017

I tried that and I get the same error. It seems like a git hook is fired right after cloning the repository and fails.
I'll try with bash, but I never had any problems with zsh + omz on Mac/Linux.

@ljharb
Copy link
Member

ljharb commented Nov 8, 2017

Git hooks only exist when locally installed; by default, there shouldn't be any git hooks.

@lamuertepeluda
Copy link

yes you are right, but I've got a lot of uncommited files right after cloning so that was my guess...

Anyway this is the output after changing to bash (chsh -s /bin/bash) and trying curl:

$curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12492  100 12492    0     0   1995      0  0:00:06  0:00:06 --:--:--  1995
=> Downloading nvm from git to '/home/vito/.nvm'
=> Cloning into '/home/vito/.nvm'...
remote: Counting objects: 263, done.
remote: Compressing objects: 100% (228/228), done.
remote: Total 263 (delta 31), reused 108 (delta 25), pack-reused 0
Receiving objects: 100% (263/263), 116.03 KiB | 15.00 KiB/s, done.
Resolving deltas: 100% (31/31), done.
Checking connectivity... done.
Note: checking out 'b546436113084d6de584c57b259b947dd467a900'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

Checking out files: 100% (239/239), done.
=> Compressing and cleaning up git repository

=> Appending nvm source string to /home/vito/.bashrc
=> Appending bash_completion source string to /home/vito/.bashrc
net.js:201
    this._handle.open(options.fd);
                 ^

Error: EINVAL: invalid argument, uv_pipe_open
    at new Socket (net.js:201:18)
    at createWritableStdioStream (internal/process/stdio.js:173:16)
    at process.getStdout [as stdout] (internal/process/stdio.js:20:14)
    at console.js:243:37
    at NativeModule.compile (bootstrap_node.js:614:7)
    at Function.NativeModule.require (bootstrap_node.js:559:18)
    at installInspectorConsole (bootstrap_node.js:339:41)
    at get (bootstrap_node.js:330:13)
    at startup (bootstrap_node.js:60:29)
    at bootstrap_node.js:626:3
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

@lamuertepeluda
Copy link

And this happens when cloning:

$git clone https:/creationix/nvm.git .nvm
Cloning into '.nvm'...
remote: Counting objects: 6598, done.
remote: Total 6598 (delta 0), reused 0 (delta 0), pack-reused 6598
Receiving objects: 100% (6598/6598), 2.01 MiB | 77.00 KiB/s, done.
Resolving deltas: 100% (4092/4092), done.
Checking connectivity... done.
error: unable to create file test/fast/Aliases/"nvm alias" should not accept aliases with slashes (No such file or directory)
error: unable to create file test/fast/Aliases/"nvm unalias" should not accept aliases with slashes (No such file or directory)
error: unable to create file test/fast/Aliases/Running "nvm alias <aliasname> <target>" again should change the target (No such file or directory)
error: unable to create file test/fast/Aliases/Running "nvm alias <aliasname>" should list but one alias. (No such file or directory)
error: unable to create file test/fast/Aliases/Running "nvm alias" lists implicit aliases when they do not exist (No such file or directory)
error: unable to create file test/fast/Aliases/Running "nvm alias" lists manual aliases instead of implicit aliases when present (No such file or directory)
error: unable to create file test/fast/Aliases/Running "nvm alias" should list all aliases. (No such file or directory)
error: unable to create file test/fast/Aliases/lts/"nvm alias" should ensure LTS alias dir exists (No such file or directory)
error: unable to create file test/fast/Listing paths/Running "nvm which 0.0.2" should display only version 0.0.2. (No such file or directory)
error: unable to create file test/fast/Listing paths/Running "nvm which foo" should return a nonzero exit code when not found (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls 0.0.2" should display only version 0.0.2. (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls 0.2" should display only 0.2.x versions. (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls foo" should return a nonzero exit code when not found (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls io" should return NA (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls node_" should return a nonzero exit code when not found (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls stable" and "nvm ls unstable" should return the appropriate implicit alias (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls system" should include "system" when appropriate (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls" should display all installed versions. (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls" should filter out ".nvm" (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls" should filter out "versions" (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls" should include "system" when appropriate (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls" should list versions in the "versions" directory (No such file or directory)
error: unable to create file test/fast/Listing versions/Running "nvm ls" with node-like versioning vx.x.x should only list a matched version (No such file or directory)
error: unable to create file test/fast/Running "nvm alias" should create a file in the alias directory. (No such file or directory)
error: unable to create file test/fast/Running "nvm current" should display current nvm environment. (No such file or directory)
error: unable to create file test/fast/Running "nvm deactivate" should unset the nvm environment variables. (No such file or directory)
error: unable to create file test/fast/Running "nvm install" with "--reinstall-packages-from" requires a valid version (No such file or directory)
error: unable to create file test/fast/Running "nvm install" with an invalid version fails nicely (No such file or directory)
error: unable to create file test/fast/Running "nvm unalias" should remove the alias file. (No such file or directory)
error: unable to create file test/fast/Running "nvm uninstall" should remove the appropriate directory. (No such file or directory)
error: unable to create file test/fast/Running "nvm uninstall" with incorrect file permissions fails nicely (No such file or directory)
error: unable to create file test/fast/Running "nvm unload" should unset all function and variables. (No such file or directory)
error: unable to create file test/fast/Running "nvm use foo" where "foo" is circular aborts (No such file or directory)
error: unable to create file test/fast/Running "nvm use iojs" uses latest io.js version (No such file or directory)
error: unable to create file test/fast/Running "nvm use system" should work as expected (No such file or directory)
error: unable to create file test/fast/Running "nvm use x" should create and change the "current" symlink (No such file or directory)
error: unable to create file test/fast/Running "nvm use x" should not create the "current" symlink if $NVM_SYMLINK_CURRENT is false (No such file or directory)
error: unable to create file test/slow/Running "nvm current" should display current nvm environment. (No such file or directory)
error: unable to create file test/slow/nvm exec/Preamble works and respects "silent" flag (No such file or directory)
error: unable to create file test/slow/nvm exec/Running "nvm exec --lts" should work (No such file or directory)
error: unable to create file test/slow/nvm exec/Running "nvm exec 0.x" should work (No such file or directory)
error: unable to create file test/slow/nvm exec/Running "nvm exec" should pick up .nvmrc version (No such file or directory)
error: unable to create file test/slow/nvm reinstall-packages/Running "nvm copy-packages $(nvm ls current)" should error out (No such file or directory)
error: unable to create file test/slow/nvm run/Running "nvm run --harmony --version" should work (No such file or directory)
error: unable to create file test/slow/nvm run/Running "nvm run --lts" should work (No such file or directory)
error: unable to create file test/slow/nvm run/Running "nvm run 0.x" should error out sensibly when 0.x is not installed (No such file or directory)
error: unable to create file test/slow/nvm run/Running "nvm run 0.x" should work (No such file or directory)
error: unable to create file test/slow/nvm run/Running "nvm run" should pick up .nvmrc version (No such file or directory)
error: unable to create file test/slow/nvm uninstall/Running "nvm uninstall 0.12.6" uninstalls v0.12.6 (No such file or directory)
error: unable to create file test/slow/nvm uninstall/Running "nvm uninstall" with incorrect file permissions fails nicely (No such file or directory)
error: unable to create file test/slow/nvm use/Running "nvm use --lts" uses latest LTS version (No such file or directory)
error: unable to create file test/slow/nvm use/Running "nvm use --lts=foo" uses latest "foo" LTS version (No such file or directory)
error: unable to create file test/slow/nvm use/Running "nvm use iojs" uses latest io.js version (No such file or directory)
error: unable to create file test/slow/nvm use/Running "nvm use node" uses latest stable node version (No such file or directory)
error: unable to create file test/slow/nvm use/Running "nvm use v1.0.0" uses iojs-v1.0.0 iojs version (No such file or directory)
error: unable to create file test/slow/nvm use/Running "nvm use" calls "nvm_die_on_prefix" (No such file or directory)
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

log.txt

Attached you see the log of cd .nvm && git status right after cloning.

@ljharb
Copy link
Member

ljharb commented Nov 8, 2017

The only things that happen after "appending bash completion" and before "Close" is:

In general, this seems like git is broken - not nvm.

@lamuertepeluda
Copy link

yes @ljharb , I tried with bash but I get the same errors on zsh

@p-salido
Copy link
Contributor

p-salido commented Dec 8, 2017

nvm repo has files with quotes in their filenames which is far from the best idea from compatibility standpoint. Looks like windows does support quotes in filenames but it likely requires \\?\ syntax to deal with them, and if OP's git client somehow references paths using the "normal" syntax it'll choke on the quotes.

@ljharb
Copy link
Member

ljharb commented Dec 8, 2017

If a windows git client chokes on perfectly valid filenames with quotes, then that git client is broken.

@isomorphisms: what is git --version for you?

@p-salido
Copy link
Contributor

p-salido commented Dec 8, 2017

Yes, the client is broken, and that doesn't make the experience of using nvm any better.

@ljharb ljharb changed the title "please report this" git on windows can’t clone nvm test filenames Aug 21, 2018
@sgarg7
Copy link

sgarg7 commented Feb 5, 2019

I'm using git bash for windows and getting the same unable to create file errors, though I have a .nvm folder installed. Is there a fix?

@ljharb
Copy link
Member

ljharb commented Feb 5, 2019

Try setting the core.autocrlf setting in your global git config.

@rlucasmo
Copy link

rlucasmo commented Dec 3, 2019

I am getting same issue. I tried playing with the core.autocrlf settings but no joy. Anyone have any other suggestions for a workaround?

@niusealeo
Copy link

niusealeo commented Mar 28, 2020

My solution is to use wsl bash shell to clone the nvm repo into the windows user .nvm dir and checkout the preferred git release. this bypasses the issue with the windows git client, by using a linux git client.
then add the export lines to the text files.
then return to a windows shell to install the preferred npm versions.

@MihailProcudin

This comment has been minimized.

@br3nt
Copy link

br3nt commented Jul 8, 2020

I'm also getting this error:

$ git clone https:/nvm-sh/nvm.git .nvm
Cloning into '.nvm'...
remote: Enumerating objects: 7745, done.
remote: Total 7745 (delta 0), reused 0 (delta 0), pack-reused 7745
Receiving objects: 100% (7745/7745), 2.63 MiB | 2.04 MiB/s, done.
Resolving deltas: 100% (4903/4903), done.
error: invalid path 'test/fast/Aliases/"nvm alias" should not accept aliases with slashes'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

I'm using Bash for Windows:

$ type git
git is hashed (/mingw64/bin/git)

$ git --version
git version 2.27.0.windows.1

The problem is windows cant have " in filenames and several of the files in the sub-directories of test contain ".

Can these be renamed?

The offending files can be seen in the following output:

$ git checkout v0.35.3
error: invalid path 'test/fast/Aliases/"nvm alias" should not accept aliases with slashes'
error: invalid path 'test/fast/Aliases/"nvm unalias" should accept aliases when they shadow a built-in alias'
error: invalid path 'test/fast/Aliases/"nvm unalias" should not accept aliases with names equal to built-in alias'
error: invalid path 'test/fast/Aliases/"nvm unalias" should not accept aliases with slashes'
error: invalid path 'test/fast/Aliases/Running "nvm alias <aliasname> <target>" again should change the target'
error: invalid path 'test/fast/Aliases/Running "nvm alias <aliasname>" should list but one alias.'
error: invalid path 'test/fast/Aliases/Running "nvm alias" lists implicit aliases when they do not exist'
error: invalid path 'test/fast/Aliases/Running "nvm alias" lists manual aliases instead of implicit aliases when present'
error: invalid path 'test/fast/Aliases/Running "nvm alias" should list all aliases.'
error: invalid path 'test/fast/Aliases/lts/"nvm alias" should ensure LTS alias dir exists'
error: invalid path 'test/fast/Listing paths/Running "nvm which 0.0.2" should display only version 0.0.2.'
error: invalid path 'test/fast/Listing paths/Running "nvm which foo" should return a nonzero exit code when not found'
error: invalid path 'test/fast/Listing versions/Running "nvm ls --no-alias" does not call into nvm_alias'
error: invalid path 'test/fast/Listing versions/Running "nvm ls --no-alias" with a pattern errors'
error: invalid path 'test/fast/Listing versions/Running "nvm ls 0.0.2" should display only version 0.0.2.'
error: invalid path 'test/fast/Listing versions/Running "nvm ls 0.2" should display only 0.2.x versions.'
error: invalid path 'test/fast/Listing versions/Running "nvm ls foo" should return a nonzero exit code when not found'
error: invalid path 'test/fast/Listing versions/Running "nvm ls io" should return NA'
error: invalid path 'test/fast/Listing versions/Running "nvm ls node_" should return a nonzero exit code when not found'
error: invalid path 'test/fast/Listing versions/Running "nvm ls stable" and "nvm ls unstable" should return the appropriate implicit alias'
error: invalid path 'test/fast/Listing versions/Running "nvm ls system" should include "system" when appropriate'
error: invalid path 'test/fast/Listing versions/Running "nvm ls" calls into nvm_alias'
error: invalid path 'test/fast/Listing versions/Running "nvm ls" should display all installed versions.'
error: invalid path 'test/fast/Listing versions/Running "nvm ls" should filter out ".nvm"'
error: invalid path 'test/fast/Listing versions/Running "nvm ls" should filter out "versions"'
error: invalid path 'test/fast/Listing versions/Running "nvm ls" should include "system" when appropriate'
error: invalid path 'test/fast/Listing versions/Running "nvm ls" should list versions in the "versions" directory'
error: invalid path 'test/fast/Listing versions/Running "nvm ls" with node-like versioning vx.x.x should only list a matched version'
error: invalid path 'test/fast/Listing versions/Running "nvm ls" with nounset should not fail.'
error: invalid path 'test/fast/Running "nvm alias" should create a file in the alias directory.'
error: invalid path 'test/fast/Running "nvm current" should display current nvm environment.'
error: invalid path 'test/fast/Running "nvm deactivate" should unset the nvm environment variables.'
error: invalid path 'test/fast/Running "nvm install" with "--reinstall-packages-from" requires a valid version'
error: invalid path 'test/fast/Running "nvm install" with an invalid version fails nicely'
error: invalid path 'test/fast/Running "nvm unalias" should remove the alias file.'
error: invalid path 'test/fast/Running "nvm uninstall" should remove the appropriate directory.'
error: invalid path 'test/fast/Running "nvm uninstall" with incorrect file permissions fails nicely'
error: invalid path 'test/fast/Running "nvm unload" should unset all function and variables.'
error: invalid path 'test/fast/Running "nvm use foo" where "foo" is circular aborts'
error: invalid path 'test/fast/Running "nvm use iojs" uses latest io.js version'
error: invalid path 'test/fast/Running "nvm use system" should work as expected'
error: invalid path 'test/fast/Running "nvm use x" should create and change the "current" symlink'
error: invalid path 'test/fast/Running "nvm use x" should not create the "current" symlink if $NVM_SYMLINK_CURRENT is false'
error: invalid path 'test/fast/Running "nvm use" should drop CR char automatically.'
error: invalid path 'test/fast/Sourcing nvm.sh should make the nvm command available.'
error: invalid path 'test/slow/Running "nvm current" should display current nvm environment.'
error: invalid path 'test/slow/nvm exec/Preamble works and respects "silent" flag'
error: invalid path 'test/slow/nvm exec/Running "nvm exec --lts" should work'
error: invalid path 'test/slow/nvm exec/Running "nvm exec 0.x" should work'
error: invalid path 'test/slow/nvm exec/Running "nvm exec" should pick up .nvmrc version'
error: invalid path 'test/slow/nvm reinstall-packages/Running "nvm copy-packages $(nvm ls current)" should error out'
error: invalid path 'test/slow/nvm run/Running "nvm run --harmony --version" should work'
error: invalid path 'test/slow/nvm run/Running "nvm run --lts" should work'
error: invalid path 'test/slow/nvm run/Running "nvm run 0.x" should error out sensibly when 0.x is not installed'
error: invalid path 'test/slow/nvm run/Running "nvm run 0.x" should work'
error: invalid path 'test/slow/nvm run/Running "nvm run" should pick up .nvmrc version'
error: invalid path 'test/slow/nvm uninstall/Running "nvm uninstall 0.12.6" uninstalls v0.12.6'
error: invalid path 'test/slow/nvm uninstall/Running "nvm uninstall" with incorrect file permissions fails nicely'
error: invalid path 'test/slow/nvm use/Running "nvm use --lts" uses latest LTS version'
error: invalid path 'test/slow/nvm use/Running "nvm use --lts=foo" uses latest "foo" LTS version'
error: invalid path 'test/slow/nvm use/Running "nvm use iojs" uses latest io.js version'
error: invalid path 'test/slow/nvm use/Running "nvm use node" uses latest stable node version'
error: invalid path 'test/slow/nvm use/Running "nvm use v1.0.0" uses iojs-v1.0.0 iojs version'
error: invalid path 'test/slow/nvm use/Running "nvm use" calls "nvm_die_on_prefix"'

@ljharb
Copy link
Member

ljharb commented Jul 8, 2020

@br3nt comments higher upthread suggest if you're using linux git inside WSL, it will work fine?

@ljharb
Copy link
Member

ljharb commented Jul 8, 2020

As long as nvm still works fine on supported systems (BashOnWindows/WSL is included, using linux software only), then the filenames aren't troublesome, and I'd prefer not to rename files with perfectly valid names just because Windows has a broken filesystem.

@br3nt
Copy link

br3nt commented Jul 9, 2020

@ljharb but it doesn't work on Bash for Windows (it uses the windows file system whereas WSL uses a completely separate linux file system)

The error in Bash for Windows is because the the windows file system doesn't accept the " character. The windows file system is just different, not broken.

An example error message:

error: invalid path 'test/fast/Aliases/"nvm alias" should not accept aliases with slashes'

@ljharb
Copy link
Member

ljharb commented Jul 9, 2020

Maybe I'm confused; WSL and BashOnWindows aren't the same thing?

If git supports a character in a filename, then either Windows, or git for windows, should handle it - perhaps it's not Windows that's broken, but git on windows.

@br3nt
Copy link

br3nt commented Jul 9, 2020

I think we're both talking about different things. I'm specifically talking about Git for Windows (also known as Git BASH) which can be downloaded from git-scm.com and gitforwindows.org.

It is different from WSL.

From this SO:

Git for Windows is using the mingw-w64 project (as illustrated here) and msys2.
See more in "How are msys, msys2, and msysgit related to each other?".
That is vastly different from WSL, which emulates an actual Linux distribution.

I can confirm I can clone the repo within WSL. But I can also confirm that I get an error (as posted above) when I clone using Git for Windows.

@br3nt
Copy link

br3nt commented Jul 9, 2020

I think it is a windows thing rather than a windows git thing because if you try to manually create a file with the same name as the ones mentioned in the error I posted in my comment above you get the following error message:

A file name can't contain any of the following characters:
\ / : * ? " < > |

You physically cannot type those characters when renaming a file (eg when right clicking on a file and selecting rename or when creating a new file).

Additionally, if you end the file name with a ., Windows will prompt you about changing the file extension, and then complete the rename, but the updated file name won't contain the trailing ..

@br3nt
Copy link

br3nt commented Jul 9, 2020

@ljharb, as a test, I have created a fork of the nvm repo and renamed all of the files with ", <, >, or ending with a ..

I am now able to successfully clone the fork with the filename changes in Git for Windows (aka Git BASH).

I can confirm I was able to source nvm.sh.
I can confirm I was able to run nvm ls and nvm ls-remote
I can also confirm I was able to run and install nvm install node... however that failed because of an unrelated error because I don't have a new enough assembler.

@br3nt
Copy link

br3nt commented Jul 9, 2020

The commits containing the renames in my fork are not in a state in which I can submit a pull request as I simply replaced those characters with an _ and that isn't a good replacement. I just wanted to try something quick and dirty to see if it would work.

I'm happy to submit a pull request though if I get some direction as to what I should replace the characters with.

@ljharb
Copy link
Member

ljharb commented Jul 9, 2020

You physically cannot type those characters when renaming a file (eg when right clicking on a file and selecting rename or when creating a new file).

What I'm saying is that the git for windows client should be quietly translating those non-Windows-compatible filenames into something that works on Windows (and changing them back as well). The definition for a working git client includes "supporting all kinds of filenames git itself supports".

  • I'm fine to remove all the trailing dots; that just seems like a consistency thing
  • The < and > are used here as delimiters in the "command line argument" sense; i'd also be fine with $aliasname instead of <aliasname>, since that's roughly the same amount of clarity.
  • The quotes could be replaced with some other delimiter character that windows supports, like perhaps ', but that seems unfortunate

With those three changes (of which I'm only content with the first two), what other issues would remain?

@br3nt
Copy link

br3nt commented Jul 10, 2020

As far as I can tell, they are the only changes that need to be made.
I just checked that the backtick (`) can be used in a windows file name. Would you prefer that?
I'll make the changes early next week.

@ljharb
Copy link
Member

ljharb commented Jul 10, 2020

nah the intention is to mirror bash command line argument conventions, for which a variable kind of matches the typical < > syntax

@petersierra1280

This comment has been minimized.

@ljharb

This comment has been minimized.

@petersierra1280

This comment has been minimized.

@ljharb

This comment has been minimized.

@br3nt
Copy link

br3nt commented Aug 11, 2020

The changes discussed above by @ljharb and myself is still on my radar/todo list... however my work priorities have changed for another few weeks. I will pick this up again once my priorities align again in the next few weeks.

@mchelen-gov
Copy link

confirming that the issue is with windows filenames as mentioned: #1643 (comment)

downloading a .zip from github https:/nvm-sh/nvm/archive/v0.35.3.zip and attempting to extract also results in errors

this is also a workaround though as the problematic files can be skipped, and the other files are still successfully extracted (unlike with git checkout)

@Yash-Singh1
Copy link
Contributor

Doesn’t windows use \ instead of /? Might be wrong, it has been a long time before I was on windows.

@mchelen-gov
Copy link

@Yash-Singh1 it looks like the quotation marks " are the issue here #1643 (comment)

@dumptyd
Copy link

dumptyd commented Sep 12, 2020

One fix could be setting up an on-push or on-tag github action that deletes tests/ and pushes to another branch which windows users can use to install nvm.

@ljharb
Copy link
Member

ljharb commented Sep 12, 2020

@dumptyd windows users using WSL and a linux version of git should be able to install it just fine; my understanding is that this is only an issue when installing/cloning on non-WSL, or when cloning for dev purposes.

@dumptyd
Copy link

dumptyd commented Sep 12, 2020

@ljharb I'm trying it install it in git bash (#1643 (comment), #1643 (comment)) so I don't have to use WSL as it's much heavier.

@ljharb
Copy link
Member

ljharb commented Sep 13, 2020

@dumptyd nvm simply won’t work on git bash - nvm requires a posix shell, so on Windows, WSL is your only option.

@elmulix
Copy link

elmulix commented Dec 29, 2020

  • Operating system and version:
    windows 10
  • nvm debug output:
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 12492 100 12492 0 0 10658 0 0:00:01 0:00:01 --:--:-- 10658
    => Downloading nvm from git to '/c/Users/CJ/.nvm'
    => Cloning into 'C:/Users/CJ/.nvm'...
    remote: Counting objects: 263, done.
    remote: Compressing objects: 100% (228/228), done.
    remote: Total 263 (delta 31), reused 108 (delta 25), pack-reused 0 eceivin
    Receiving objects: 100% (263/263), 116.01 KiB | 2.97 MiB/s, done.
    Resolving deltas: 100% (31/31), done.
    Note: checking out 'b546436113084d6de584c57b259b947dd467a900'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

error: unable to create file test/fast/Aliases/"nvm alias" should not accept aliases with slashes: Invalid argument
error: unable to create file test/fast/Aliases/"nvm unalias" should not accept aliases with slashes: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias " again should change the target: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias " should list but one alias.: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias" lists implicit aliases when they do not exist: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias" lists manual aliases instead of implicit aliases when present: Invalid argument
error: unable to create file test/fast/Aliases/Running "nvm alias" should list all aliases.: Invalid argument
error: unable to create file test/fast/Aliases/lts/"nvm alias" should ensure LTS alias dir exists: Invalid argument
error: unable to create file test/fast/Listing paths/Running "nvm which 0.0.2" should display only version 0.0.2.: Invalid argument
error: unable to create file test/fast/Listing paths/Running "nvm which foo" should return a nonzero exit code when not found: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls 0.0.2" should display only version 0.0.2.: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls 0.2" should display only 0.2.x versions.: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls foo" should return a nonzero exit code when not found: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls io" should return NA: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls node_" should return a nonzero exit code when not found: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls stable" and "nvm ls unstable" should return the appropriate implicit alias: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls system" should include "system" when appropriate: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should display all installed versions.: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should filter out ".nvm": Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should filter out "versions": Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should include "system" when appropriate: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" should list versions in the "versions" directory: Invalid argument
error: unable to create file test/fast/Listing versions/Running "nvm ls" with node-like versioning vx.x.x should only list a matched version: Invalid argument
error: unable to create file test/fast/Running "nvm alias" should create a file in the alias directory.: Invalid argument
error: unable to create file test/fast/Running "nvm current" should display current nvm environment.: Invalid argument
error: unable to create file test/fast/Running "nvm deactivate" should unset the nvm environment variables.: Invalid argument
error: unable to create file test/fast/Running "nvm install" with "--reinstall-packages-from" requires a valid version: Invalid argument
error: unable to create file test/fast/Running "nvm install" with an invalid version fails nicely: Invalid argument
error: unable to create file test/fast/Running "nvm unalias" should remove the alias file.: Invalid argument
error: unable to create file test/fast/Running "nvm uninstall" should remove the appropriate directory.: Invalid argument
error: unable to create file test/fast/Running "nvm uninstall" with incorrect file permissions fails nicely: Invalid argument
error: unable to create file test/fast/Running "nvm unload" should unset all function and variables.: Invalid argument
error: unable to create file test/fast/Running "nvm use foo" where "foo" is circular aborts: Invalid argument
error: unable to create file test/fast/Running "nvm use iojs" uses latest io.js version: Invalid argument
error: unable to create file test/fast/Running "nvm use system" should work as expected: Invalid argument
error: unable to create file test/fast/Running "nvm use x" should create and change the "current" symlink: Invalid argument
error: unable to create file test/fast/Running "nvm use x" should not create the "current" symlink if $NVM_SYMLINK_CURRENT is false: Invalid argument
error: unable to create file test/slow/Running "nvm current" should display current nvm environment.: Invalid argument
error: unable to create file test/slow/nvm exec/Preamble works and respects "silent" flag: Invalid argument
error: unable to create file test/slow/nvm exec/Running "nvm exec --lts" should work: Invalid argument
error: unable to create file test/slow/nvm exec/Running "nvm exec 0.x" should work: Invalid argument
error: unable to create file test/slow/nvm exec/Running "nvm exec" should pick up .nvmrc version: Invalid argument
error: unable to create file test/slow/nvm reinstall-packages/Running "nvm copy-packages $(nvm ls current)" should error out: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run --harmony --version" should work: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run --lts" should work: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run 0.x" should error out sensibly when 0.x is not installed: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run 0.x" should work: Invalid argument
error: unable to create file test/slow/nvm run/Running "nvm run" should pick up .nvmrc version: Invalid argument
error: unable to create file test/slow/nvm uninstall/Running "nvm uninstall 0.12.6" uninstalls v0.12.6: Invalid argument
error: unable to create file test/slow/nvm uninstall/Running "nvm uninstall" with incorrect file permissions fails nicely: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use --lts" uses latest LTS version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use --lts=foo" uses latest "foo" LTS version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use iojs" uses latest io.js version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use node" uses latest stable node version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use v1.0.0" uses iojs-v1.0.0 iojs version: Invalid argument
error: unable to create file test/slow/nvm use/Running "nvm use" calls "nvm_die_on_prefix": Invalid argument
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

Failed to clone nvm repo. Please report this!

  • nvm ls output:

  • How did you install nvm? (e.g. install script in readme, homebrew):

  • What steps did you perform?

  • What happened?

  • What did you expect to happen?

  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?

  • If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?

I was getting the first line error error: unable to create file test/fast/Aliases/"nvm alias" should not accept aliases with slashes: Invalid argument . After some research I gave up and dowloaded this .zip from this link https://content.breatheco.de/en/how-to/nvm-install-windows#:~:text=Install%20nvm%20Go%20to%20your,that%20you%20will%20hit%20too.
And problem solved.

Saludos!

@ljharb
Copy link
Member

ljharb commented Jan 8, 2024

I believe this is fixed in #2397.

@ljharb ljharb closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests