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

Issue with setting node version #30

Closed
vigneshdv opened this issue Dec 24, 2014 · 5 comments
Closed

Issue with setting node version #30

vigneshdv opened this issue Dec 24, 2014 · 5 comments

Comments

@vigneshdv
Copy link

I have installed nvm under the path:
C:/Program Files/nvm

After installing I ran the following command to install latest version of node:
nvm install latest all

I then ran the following command to set the node version I wanted to use:
nvm use v0.10.34

It showed the following error message
error

From the error message I think the issue is that the file path to nvm/node contains space i.e. the space in the between "Program Files" of the file path where I have installed them.

Running the following command also threw a similar error:
error1

I presume the file paths cannot handle spaces between them. A simple fix on this would be great.

@coreybutler
Copy link
Owner

There are a lot of users successfully installing to C:\Program Files, so I it's unlikely to be an escaping issue. You shouldn't even have to do any of this if you used the installer, which sets up the PATH for you. Did you use the manual installation?

The second example is an error with the syntax you're typing in. It should be C:\>"%NVM_HOME%\v0.10.34\node.exe -v"... notice the quotes.

Which version of Windows are you running?

@vigneshdv
Copy link
Author

I ran the installer, setting the installation directory to install inside C:\Program Files.
I'm running Windows 7. The PATH variables were set via the installer.

@butaixianran
Copy link

I have the same error on win7...
And I find out why.
The nodejs folder can have a space like "C:\Program Files". But, the folder of nvm-windows can't !

This problem is caused by changing the nvm instllation directory to "C:\Program Files\nvm".
Remove and re-install nvm-windows to some place like "c:\nvm" will be ok.

by the way, nvm-windows is much better than nvmw, really good job.

@gdvallance
Copy link

I can confirm either the same bug, or s similar one. However, I can also confirm the work around by @butaixianran above works fine.

From the errors I got, the execution of 'nvm use 0.10.35' got hung up on the fact that my Username is Grant D. Vallance ... A clue?

Thank you @butaixianran and thankyou @coreybutler for a very useful piece of software. Appreciated.

CodeBlueDev added a commit to CodeBlueDev/nvm-windows that referenced this issue Jul 13, 2017
The Go version used for the repository development could not be found
so the latest installation available was used. In doing so, some compile
time errors appeared with regards to filepath and the Unzip function
that had to be corrected.

The Go exec module wraps the os.StartProcess functionality. The initial
argument escaping appears to be correct, however, during the pipe
writing when actually starting the process the command is escaped again
in quotations making the command invalid. This makes the command fail
and no symlink is created.

This was verified by printing the resulting argument string by utilizing
the same logic that makes the command line argument and escapes it. As
this appears to be a Go library issue, a different tactic was attempted.
In case of this failure, a backup mechanism has been put in place to
use the os module to create the symlink directly.

After much deliberation it was decided this backup mechanism should only
be attempted when the initial attempt fails. The reasoning behind this
is because the initial command request attempts to elevate the command
which would give access to create the symbolic link in "Program Files",
which is otherwise a protected folder. The os call could fail here due
to insufficient permissions.

Potentially fixes: coreybutler#281, coreybutler#266, coreybutler#30
@coreybutler
Copy link
Owner

Resolved with PR #355.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants