Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ Got a list of default packages you want installed every time you install a new N
set --universal nvm_default_packages yarn np
```

## `$nvm_data`

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

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.

Suggested change
set --global nvm_data ~/.nvm
set --universal nvm_data ~/.nvm

Copy link
Owner

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?

Copy link
Owner

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.

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

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.

Copy link
Owner

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!

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.

```

## Acknowledgments

`nvm.fish` was established in 2016 by [**@jorgebucaran**](https://github.com/jorgebucaran) as the go-to Node.js version manager for Fish. It was inspired by the original [**nvm.sh**](https://github.com/nvm-sh/nvm) created by [**@creationix**](https://github.com/creationix) and [**@ljharb**](https://github.com/ljharb). To use the original nvm in Fish, consider [**@FabioAntunes/fish-nvm**](https://github.com/FabioAntunes/fish-nvm) or [**@derekstavis/plugin-nvm**](https://github.com/derekstavis/plugin-nvm). We appreciate all of our contributors! ❤️
Expand Down
4 changes: 2 additions & 2 deletions conf.d/nvm.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
set --global nvm_data $XDG_DATA_HOME/nvm
set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
set --query nvm_data || set --global nvm_data $XDG_DATA_HOME/nvm

function _nvm_install --on-event nvm_install
test ! -d $nvm_data && command mkdir -p $nvm_data
Expand Down
1 change: 1 addition & 0 deletions functions/nvm.fish
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function nvm --description "Node version manager"
echo " nvm_mirror Use a mirror for downloading Node binaries"
echo " nvm_default_version Set the default version for new shells"
echo " nvm_default_packages Install a list of packages every time a Node version is installed"
echo " nvm_data Set a custom directory for storing nvm data"
echo "Examples:"
echo " nvm install latest Install the latest version of Node"
echo " nvm use 14.15.1 Use Node version 14.15.1"
Expand Down