coreybutler/nvm-windows

Error when issuing 'nvm use' command in git-bash terminal

Daren-J-Smith opened this issue · 9 comments

When attempting to issue an 'nvm use <installed.version>', an error is issued due to a program association in windows. I have tried to associate .cmd files with git-bash, but the error is still present. I will perform some additional troubleshooting and see if the error can be worked around. The git version being used is git version 2.7.0.windows.1

image
image

Make sure the mklink function is available in git-bash. NVM uses this command to manage which version of node to use.

That makes sense. I'll look into mklink in git-bash, it probably conflicts with ln that is part of the git distro for Windows.

I've been experiencing this as well. As a workaround, I just open up a normal cmd window, and then run nvm use from that. I'm also attempting to see if I can find a way to have mklink usable in git-bash.

I'm closing this due to a) age and b) because I think the issue has to do with mklink compatibility. And I guess c) git-bash is it's own shell and I can't support every custom shell (PR's totally welcome though!).

Thought I'd provide an update on this. I tested this again with git bash version 2.9.2 today and the mklink function is now working correctly, so nvm use can now be executed correctly from a git bash terminal. Thanks again for providing this tool. Invaluable to users that have to perform some development on the Windows platform.

Thanks for the update, and it's quite awesome this is working in the latest git bash shell!

Hi @Daren-J-Smith. What version of Windows are you running?

Also, did you choose the "Use Git from the Windows Command Prompt" option when installing Git 2.9.2?

I just installed NVM 1.1.1 on Win7 Pro 64-bit as per this comment but I get "command not found" when I attempt to run mklink from the 2.9.2.windows.1 bash shell:

RMirro ~
$ git --version
git version 2.9.2.windows.1

RMirro ~
$ mklink
bash: mklink: command not found

mklink is available when I use the windows command prompt (cmd):

C:\Users\rmirro>mklink
Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

Thanks!

I was able to resolve this issue.

For me nvm install lts in the power shell made it work in git bash terminal. Mostly because I had no npm installed at all.