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 blank spaces in path #41

Closed
emartinpi opened this issue Feb 17, 2015 · 73 comments
Closed

Issue with blank spaces in path #41

emartinpi opened this issue Feb 17, 2015 · 73 comments

Comments

@emartinpi
Copy link

Hello! I'm having a problem when i'm trying nvm use <node_version>
captura
Sorry for the spanish language in screenshot. It means "c:\Users\Edu" is not recognise as an internal command... bla bla bla.
My user name is "Edu Martin" and my path is "c:\Users\Edu Martin\AppData\Roaming\nvm"
Is it possible to be an error with black spaces in the path?? All settings in my app are standard

@bholloway
Copy link

+1

Workaround for me was to uninstall and then reinstall for Public user. Not ideal but happy to be running NVM on windows!

@impaler
Copy link

impaler commented Mar 15, 2015

+1 many windows installs have user names with spaces

@kirkouimet
Copy link

+1 for this, ran into this same issue with my username

1

@kirkouimet
Copy link

So a fix to this is to edit your settings.txt and use the alternate Windows folder naming scheme which does not have spaces, which for my case was:

2

(settings.txt is in AppData\Roaming\nvm by default)

@PureKrome
Copy link

@coreybutler can we please have a fix for this, please please please?

🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏

here's a gif to try and co-coerce you...

@coreybutler
Copy link
Owner

My build environment has changed recently/substantially, so the problem is releasing the binaries (I had a really customized build script). I'd be happy to add the fix to the master branch, it would just require building from source.

I have to head to the UK next week, but when I return to the US I'll address this as soon as I can.

@PureKrome
Copy link

That would be lovely @coreybutler :) Also, maybe we can link the next build (with this patch) to #17 etc?

@CMaso
Copy link

CMaso commented Jun 9, 2015

I was having this problem because it wanted to use "C:\Documents and Settings(my name)\Application Data\nvm" as the root. So what I did was reinstall nvm, specifying "C:" as the root instead of the default during the install, so it's now storing all the versions of Node in "C:\nvm", which of course has no spaces in the path. Settings.txt confirms this as the root. I just needed to remember to cd to C:\ before using any of the nvm commands, else it threw an error saying it can't find settings.txt. In my case, since C:\ isn't associated with any one user, when I switch to a version of Node using "nvm use <version>" it asks me which user account I want to use to run the program. But it seems to be running fine; I'm getting the "now using node <version>" message.

@mhchristensen
Copy link

+1 For anyone wanting to do the workaround editting the settings.txt you can try this from command line to get the correct formatted path

cmd /c for %A in ("C:\Users\My Name With Spaces\AppData\Roaming\nvm") do @echo %~sA

@markbrownsword
Copy link

markbrownsword commented Nov 19, 2015

Installing nvm-windows into Program Files also causes this error. Updating settings.txt as below resolves the issue, but it would be nice to get this fixed, or added to the ReadMe as a 'Gotcha'!

root: C:\PROGRA1\nvm
path: C:\PROGRA
1\nodejs

@clmcgrath
Copy link
Contributor

using a symbolic junction link on windows i found is a suitable workaround to this problem as well
use something like this
mklink /J nvm_home "C:\Users\Chris McGrath\AppData\Roaming\nvm"

then up date settings.txt with the junction address

once i created this link switching started working with out any problems

@codeimpossible
Copy link

So this issue has been open for almost a year. Is nvm-windows dead?

@coreybutler
Copy link
Owner

@codeimpossible - Not dead, I've just had higher life priorities to deal with. I'll post a note about it in gitter.

@kirkouimet
Copy link

@coreybutler just wanted to let you know I use nvm-windows every day and appreciate all of the hard work you put into the project

@coreybutler
Copy link
Owner

@kirkouimet Thanks... thrilled to hear it is helpful!

@AntiCZ
Copy link

AntiCZ commented Jul 28, 2016

Hi coreybutler, great job with nvm. This is really making my life easier :D

But can you write anywhere info about the space? Something like

"If you have a space in your user name change default directory used by the installer and choose path without a space."

I have never edit wiki on github. I have a little fear what I can do.

@coreybutler
Copy link
Owner

@AntiCZ - Good idea. I added a common issues page to address this. I'll continue to add to this as neccessary.

@andrianina-oelimahefason
Copy link

andrianina-oelimahefason commented Aug 17, 2016

I solve mine using:
cmd /c for %A in ("C:\Users\My Name With Spaces\AppData\Roaming\nvm") do @echo %~sA
by @mhchristensen .
And then change the root in the setting.txt
Thanks a lot 👍

@espoelstra
Copy link

espoelstra commented Nov 2, 2016

Without a space in $env:USERPROFILE are people still having problems with the nodejs path having spaces in Program Files? I'm not seeing the same behavior on my Windows 2012R2 VM.

I'm going to test with a user with a space in the name to see if that is causing a cascading failure of some sort. It would be great to get some OS versions and which cmd prompt you are using (PowerShell/CMD/Bash4Windows/GitBash).

Right now I'm refactoring a Chocolatey package somebody created for nvm and hope to publish it soon. It avoids the installer and uses the chocolatey install path which doesn't have spaces, and I haven't had any issues with the node path having spaces in the settings.txt file.

@SamHard
Copy link

SamHard commented Nov 19, 2016

I had almost this same issue, except my user name has an ampersand (&) instead of a space. In this situation, using the alternate folder name didn't help, because even the short name still has the ampersand. However, creating a symbolic link, as @clmcgrath suggested, was a good workaround for me.

@kyleshrader
Copy link

kyleshrader commented Dec 13, 2016

Just install it to a directory without anything special. For example: C:\nvm\

@Laslo89
Copy link

Laslo89 commented Jan 23, 2019

root: C:\PROGRA1\nvm
path: C:\PROGRA1\nodejs

The config above mentioned earlier in this thread is wrong, or does not work for me at least ... ;)
For anyone who stumbles upon this issue.
When you have installed nvm and nodejs in C:\Program Files just use the following config in settings.txt and it should work.

root: C:\PROGRA~1\nvm
path: C:\PROGRA~1\nodejs

@tpscrpt
Copy link

tpscrpt commented Feb 4, 2019

@Laslo89 has the right answer, replacing the space with ~ works well

@morgyface
Copy link

So a fix to this is to edit your settings.txt and use the alternate Windows folder naming scheme which does not have spaces, which for my case was:

2

(settings.txt is in AppData\Roaming\nvm by default)

A quick note for those lacking general tech ability like me. If you use dir *. /x in the command prompt it will list out the directories within the current location giving you the 8.3 form name in the middle column. You can then use this to change the settings as outlined above. Though, as mentioned earlier, Program Files becomes PROGRA~1.

@psiddharth709
Copy link

psiddharth709 commented Mar 8, 2019 via email

@julian-becker
Copy link

how is this issue still not fixed?! If it is a regression in 1.1.7, maybe think about adding a few integration/unit/regression tests to cover the not-so-uncommon case of spaces in windows (or linux for that matter) path names before releasing it...

Do you guys need support on this or is there already someone actively working on this?

@seanpoulter
Copy link

seanpoulter commented Apr 25, 2019

@julian-becker, first off I'd like to call you out your aggressive start:

how is this issue still not fixed?!

It's rude. Folks in the open source community don't owe you any of their time or attention. What makes your spare time any more precious than the maintainers, or ours? It seems like you didn't spend the time to see that @coreybutler has already answered your question here:

I have a great problem - lots of new clients flowing into my consulting company. The problem: abnormally little time to work on anything else.

You also missed the solution and fork that @s-h-a-d-o-w shared.

Second, you've got a great game plan for how this should be done. Do it! If you've got the time, everyone watching this issue will appreciate it being fixed. Have a look at what @s-h-a-d-o-w has done, add the tests, get a PR going, and reach out here for help with the code-review. Someone is self-interested enough to help get'r done. Good luck, and reach out here if you need some help! 👏

@s-h-a-d-o-w
Copy link
Contributor

get a PR going

To avoid possible confusion and work being done twice, I'd like to note that my fix was already merged, it's just a matter of actually releasing it.

@seanpoulter
Copy link

Perfect! I didn't have that much time to read either. 😆

@kstreichergb
Copy link

@s-h-a-d-o-w Just ran into this problem again, any idea when it will be released?

@s-h-a-d-o-w
Copy link
Contributor

@coreybutler Would you mind linking to the release in my fork in a final post here and then locking this thread? I don't think that there is a need to discuss it further...

@scote
Copy link

scote commented Aug 20, 2019

@coreybutler may it be possible to do the release?

@sittingbool
Copy link

Please release this :)

@AndersSchultz
Copy link

Using the fork released by s-h-a-d-o-w (see link above) worked for me as the only thing. Big thanks!

@coreybutler
Copy link
Owner

I've linked to @s-h-a-d-o-w 's release in common issues.

Sorry it is taking me so long to cut a release. I know it seems straightforward, but time has been brutal for me. Maybe I'll write about it someday.

@fullsteack
Copy link

1.In cmd, go to your home directory and type dir/x to see the shortened name for this folder
2.Then replace your user name with this shortened name in the setting.txt
3.It works

@vineethm1627
Copy link

+1 For anyone wanting to do the workaround editting the settings.txt you can try this from command line to get the correct formatted path

cmd /c for %A in ("C:\Users\My Name With Spaces\AppData\Roaming\nvm") do @echo %~sA

Thanks a lot this thing saved my life.

@Swarag-N
Copy link

Solved!!

For someone who is not able to work with ~1 method by @kirkouimet (Thanks mate)
Open CMD go to the Users folder and Get the Shortened Folder name.

and type

> dir\x

Annotation 2020-05-25 112714

Now later after copying or Noting down the folder name
Annotation 2020-05-25 113201

Hope it helps

@wafakhan9232
Copy link

wafakhan9232 commented Jun 12, 2020

Solved!!

For someone who is not able to work with ~1 method by @kirkouimet (Thanks mate)
Open CMD go to the Users folder and Get the Shortened Folder name.

and type

> dir\x

Annotation 2020-05-25 112714

Now later after copying or Noting down the folder name
Annotation 2020-05-25 113201

Hope it helps

Thank you, everyone, that suggested the settings.txt solution but specially Swarag-N for such a thorough explanation. I am glad I landed here and not changed my user profile folder name.
Thanks

@sourabh69733
Copy link

Please check this page, it works for me
https://oclockvn.github.io/2019/04/29/common-issues-nvm-on-windows.html

@noelsimbolon
Copy link

noelsimbolon commented Jul 13, 2021

So a fix to this is to edit your settings.txt and use the alternate Windows folder naming scheme which does not have spaces, which for my case was:

2

(settings.txt is in AppData\Roaming\nvm by default)

This worked for me. Thank you!

To do this, basically you have to:

  1. In Command Prompt, go to your home directory and type dir/x to see the shortened name for this folder. The output would be like this.
    image
  2. Then, edit your settings.txt file like instructed on the comment above.

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