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

Getting "exit status 1: 'C:\Program' is not recognized as an internal or external command" when switching versions #168

Closed
lnaie opened this issue May 12, 2016 · 26 comments

Comments

@lnaie
Copy link

lnaie commented May 12, 2016

I have installed v1.1.0 in "C:\Program Files\nvm". All good but when I'm trying to switch to a version I have installed I get:

C:\WINDOWS\system32>nvm use 5.10.1
exit status 1: 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
@andrehdias
Copy link

The problem is with the spaces in URL(C:\Program Files). Try to install the nvm directly in C:/ or in other folder without spaces in the PATH.

@lnaie
Copy link
Author

lnaie commented Jun 2, 2016

Yes, but that is :)).

@coreybutler
Copy link
Owner

Duplicate of #41.

@enaldick
Copy link

windows

move to path there without whitespace

or

running cmd as administrator
and then mklink it to the new path there without whitespace.

@rwadkins
Copy link

One of my users is having the same problem. However, moving nvm to another folder doesn't work for us, because our security policies don't allow us to run applications outside of Program Files or Program Files (x86) folders. It would be helpful if the code allowed it to run in a directory with spaces.

@AlexYalovoy
Copy link

Change root directory for version of nodes (without spaces)
Then You can install there node and use it
Example:
nvm root C:\nodejs\nvm
nvm install 10.0.0
nvm use 10.0.0

@JoshRosenstein
Copy link

Issue is old but for anyone that lands here you can reinstall nvm as mentioned above,
Or use short path. Changing C:\Program Files\nvm with nvm root C:\PROGRA~1\nvm
Might also want to use shortPath for NVM_SYMLINK : C:\Program Files\nodejs to C:\PROGRA~1\nodejs

@havettaa
Copy link

You have changed the default path during installation.
I uninstalled nvm, and installed it with default paths, all works fine.

@vaishnavravi33
Copy link

The problem is with the spaces in URL(C:\Program Files). Try to install the nvm directly in C:/ or in other folder without spaces in the PATH.

Yes, That's work thanks :)

@ChrisTranzynergy
Copy link

So if I put a space in my name when I got the computer, I'm just screwed forever, huh?

@bhupenderkeswani
Copy link

bhupenderkeswani commented Nov 7, 2020

a better solution is : #405

Open Cmd, go to the Users directory, type dir /x and you will see the shortened version of the name of the users. (ALEXKA~1 in my case)
Inside the nvm installation (AppData\Roaming\nmv in my case) there is a settings file, edit the first line and instead of having the space name put that shortened version and leave the rest the same like this :
root: C:\Users\ALEXKA~1\AppData\Roaming\nvm

@zohar1000
Copy link

@bhupender005 that's greate, better than all the other answers, thanks!

@VishwasGajawada
Copy link

@bhupender005 Thanks for your neat risk-free solution

@valdezm
Copy link

valdezm commented Feb 27, 2021

If you manually move the nvm folder to for instance to C:\nvm you will need to:

Update the environment variable(NVM_HOME, both user and system ENV variables) so that your terminal recognizes the new location:

Once the environment variables are updated and you restart your terminal/command prompt, nvm should work, but the settings are still attached to the previous location, which will cause an error if you attempt to nvm list or mostly any other command.

Running nvm root will show that old location, all you have to do is set it with nvm root C:\nvm
(given the location you updated it to was C:\nvm, which is the same location you set the environment variable to).

Otherwise you will get errors saying that nvm is referencing the old path.

UPDATE:

once that is done your symlink is now corrupt C:\Program Files\nodejs variable NVM_SYMLINK.

You have to manually update the symlink by right-clicking the properties(of the symlink at: C:\Program Files\nodej) and specifying the location of an executable node, which is where you moved it: C:\nvm\v6.11.3 and select the executable node file.

then restart the terminal/cmd and nvm off and nvm on and it will work, you will see if you issues the nvm list command:

  • 6.11.3 (Currently using 64-bit executable)
    (given that 6.11.3 is the version you have)

That was not fun.

Repository owner deleted a comment from pedroBaptistaDosSantos May 3, 2021
@kothariji
Copy link

@

a better solution is : #405

Open Cmd, go to the Users directory, type dir /x and you will see the shortened version of the name of the users. (ALEXKA~1 in my case)
Inside the nvm installation (AppData\Roaming\nmv in my case) there is a settings file, edit the first line and instead of having the space name put that shortened version and leave the rest the same like this :
root: C:\Users\ALEXKA~1\AppData\Roaming\nvm

@bhupender005 Thank you so much for this solution. Its working 🔥

@raiandexter0607
Copy link

The problem is with the spaces in URL(C:\Program Files). Try to install the nvm directly in C:/ or in other folder without spaces in the PATH.
I love you friend

@lutherjohnworks
Copy link

a better solution is : #405

Open Cmd, go to the Users directory, type dir /x and you will see the shortened version of the name of the users. (ALEXKA~1 in my case)
Inside the nvm installation (AppData\Roaming\nmv in my case) there is a settings file, edit the first line and instead of having the space name put that shortened version and leave the rest the same like this :
root: C:\Users\ALEXKA~1\AppData\Roaming\nvm

this one solved my problem.

@lawweiliang
Copy link

Jeus, I am testing here and there. Finally found out that the problem is space. Thanks @lutherjohnworks

@suman-saket
Copy link

@bhupender005 Thankyou for your neat and clear solution .My issue was solved without any issue following your steps.

@carlosviniciusananias
Copy link

O problema é com os espaços na URL (C: \ Arquivos de Programas). Tente instalar o nvm diretamente em C: / ou em outra pasta sem espaços no PATH.

My issue was solved. Thanks!

@riyastir
Copy link

Spacing in the path is the problem

you can run

nvm root and find the root folder

then copy the contents to another folder without any spaces on the path

after that move the nvm root to that folder by running the command below (with full path)

nvm root [path]

@Anaizing
Copy link

Anaizing commented Apr 7, 2022

#168 (comment)

Thank you. I moved my nvm up to C:\nvm and my symlink was also C:\Program Files\nodejs
Which on windows can be checked via control panel click on Users then click on Change my environment variable

However it wasn't until i ran
nvm off nvm on that it all worked as expected. Thanks!!!

@zeeshansafdar48
Copy link

Spacing in the path is the problem

you can run

nvm root and find the root folder

then copy the contents to another folder without any spaces on the path

after that move the nvm root to that folder by running the command below (with full path)

nvm root [path]

Also if you are facing an error with the path, just write the path in single quotes.

@maitrithanh
Copy link

Run git bash or cmd administrator. It worked for me.

@KaitoKid1612
Copy link

Xoá node trên máy đi rồi cài lại từ đầu là được

@Zan-14
Copy link

Zan-14 commented Oct 8, 2023

a better solution is : #405

Open Cmd, go to the Users directory, type dir /x and you will see the shortened version of the name of the users. (ALEXKA~1 in my case) Inside the nvm installation (AppData\Roaming\nmv in my case) there is a settings file, edit the first line and instead of having the space name put that shortened version and leave the rest the same like this : root: C:\Users\ALEXKA~1\AppData\Roaming\nvm

Bruh, after trying many ways, this is the one for me.

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