nvm: git on windows can’t clone nvm test filenames

  • 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 <new-branch-name>

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 <aliasname> <target>” again should change the target: Invalid argument error: unable to create file test/fast/Aliases/Running “nvm alias <aliasname>” 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?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 46 (21 by maintainers)

Most upvoted comments

I’m also getting this error:

$ git clone https://github.com/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"'

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

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

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.

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.

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

@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.

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.