-
Notifications
You must be signed in to change notification settings - Fork 74
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
Allow setting nvm's custom install directory #231
base: main
Are you sure you want to change the base?
Conversation
Thank you! I'll take a little time to think it over and decide if I want to go for it or not. |
I really want this! |
You have to add that variable here: Lines 47 to 51 in a0892d0
|
I've updated the help desc. |
How about calling it nvm_data instead of nvm_dir? |
This makes sense, I've refactored the changes. |
The latest branch is unable to resolve the version with the default node version variable. |
It should be good now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
🎉 |
Oops, it still does not seem to resolve the default version 🤷♂️ |
Ohh really? |
This PR enables a simpler way to customize the data directory. It does not affect the default version, or did I misunderstand you? |
Set where nvm stores Node binaries and related data. Defaults to `$XDG_DATA_HOME/nvm` (~/.local/share/nvm) if unset. | ||
|
||
```fish | ||
set --global nvm_data ~/.nvm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If set globally, it will not work.
set --global nvm_data ~/.nvm | |
set --universal nvm_data ~/.nvm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will not work exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to put it in your config.fish. Unless we intended this feature to work interactively, which I did not assume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It causes the following error:
nvm: Can't use Node "22", version must be installed first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course I added that to config.fish, but it did not work unless I set it as universal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks. I'll investigate then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may have been shadowed by setting the variable in different ways.
I don't know why only global does not work with the default version, but this seems like the reason. # Blow up everything
set --erase --universal --global nvm_data
# This does not work...
set --global nvm_data $HOME/.nvm
# Blow up again
set --erase --global nvm_data
# This works
set --universal nvm_data $HOME/.nvm |
Anyway, just update the documentation and then we can go ahead! |
Oops, wait, now it works. There is a possibility that I made a mistake in the somewhere. |
You may also have to update the documentation to set |
We need one of those to be universal when setting the default version for new shells because your config.fish is sourced last. |
I actually had to set both the default version and the data directory as universal. |
I'll investigate. |
Thanks a lot! |
Description:
Allow setting nvm's custom install directory.
If
$nvm_data
is set, it would use this path as the install directory.Otherwise default to
$XDG_DATA_HOME
.Changes:
$nvm_data
to$XDG_DATA_HOME
if$nvm_data
is not set.README.md
detailing how to set$nvm_data
.$nvm_data
variable.Ref: #146