-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
nvm use fails when NVM_DIR ends with a slash #1708
Comments
Hmm, how did the trailing slash end up there in the first place? |
@ljharb That was a configuration that our Admins were setting up in our Bamboo CI. Of course we had them change that now, but I found it a bit disturbing that a slash in the "wrong" place can do this harm. It's not only the function I mentioned above that has a problem with this. Also calling |
@chrisse27 would you be interested in submitting a PR that explicitly fails with a helpful error message when a directory path has a trailing slash, in all the places you find, with associated tests? |
(please do note; a slash in the wrong place with |
@ljharb I can do that, although we are still discussing among the team whether it's better to educate the users or help them by normalizing the path. |
I think that since the primary use case for |
Just had a look at the code. Adding an error message everywhere where NVM_DIR is used is too much of an effort. I will submit an PR for a change in the documentation. |
Path ends with trailing |
Thanks for the fix @PeterDaveHello. I am looking forward to the discussions with @ljharb regarding how valid the trailing slash is. |
@chrisse27 let me know if it fixes your problem if you have time to test it, thanks :) |
It can be fixed, but no, it's not valid. Try using |
Yes, I tested |
You may have been trying with the source arg, or with a nonexistent dest arg. Try |
I got what do you mean, still no problem here though. |
In the former example it will replace |
Yeah, I know the difference, but in the case of |
Not at the moment; but that doesn’t change that the proper path to a directory has no trailing slash :-) |
Operating system and version: Linux
nvm debug
output:nvm ls
output:nvm
? (e.g. install script in readme, homebrew):Install script in readme
That nvm switches to the new Node version.
This is a bug in the function nvm_tree_contains_path which cannot deal with trailing slashes in the NVM_DIR variable. removing the slash solves the problem. I anyway opened this issue to spare future users hours of painful debugging.
.bashrc
,.bash_profile
,.zshrc
, etc) that modifies thePATH
?curl -I --compressed -v https://nodejs.org/dist/
print out?The text was updated successfully, but these errors were encountered: