jorgebucaran / nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
https://git.io/nvm.fish
MIT License
2.08k stars 69 forks source link

Create index dir if not present on _nvm_index_update #174

Closed eugenetriguba closed 2 years ago

eugenetriguba commented 2 years ago
> nvm install lts
<W> fish: An error occurred while redirecting file '/home/eugene/.local/share/nvm/.index.temp'
open: No such file or directory
nvm: Can't update index, host unvailable: "https://nodejs.org/dist"

If the $index path does not exist in _nvm_index_update, it shows an error about not being able to update the index because the host is unavailable. However, really, it is because that index directory path is missing.

> nvm install lts
Installing Node v16.14.0 lts/gallium
Fetching https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.gz
Now using Node v16.14.0 (npm - not installed) ~/.local/share/nvm/v16.14.0/bin/node
jorgebucaran commented 2 years ago

The index path aka $nvm_data is created here

https://github.com/jorgebucaran/nvm.fish/blob/e4e603af527677dc954c5e6d1730bdf36f0e5ba1/conf.d/nvm.fish#L6

which runs when you install nvm. If you also happen to uninstall nvm and install it again it will be recreated too.

So, how did you get into a situation where it didn't exist?