jorgebucaran / nvm.fish

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

Invalid index or unavailable host #130

Closed lkonya closed 3 years ago

lkonya commented 3 years ago

Whenever I try to nvm install or nvm install v12.20.0 I receive the same error message:

~/.config/fish/functions/_nvm_index_update.fish (line 7): Invalid redirection target: 
    ' >$index.temp && command mv $index.temp $index && return
      ^
in function '_nvm_index_update'
        called on line 32 of file ~/.config/fish/functions/nvm.fish
in function 'nvm' with arguments 'install v12.20.0'
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
nvm: Invalid index or unavailable host: ""

MacOS: 11.1

~ ❯ fish --version
fish, version 3.1.2

~ ❯ fisher --version
fisher, version 4.1.0

~ ❯ nvm --version
nvm, version 2.0.1

.nvmrc content: v12.20.0

jorgebucaran commented 3 years ago

@lkonya It appears that $nvm_mirror was not correctly set. Did you happen to set nvm_mirror to an empty string (inadvertently or not) for some reason?

What does this tell you?

$ la ~/.local/share/
$ echo $nvm_data
$ echo $nvm_mirror

I expect $nvm_mirror to be empty for you. If it isn't, run this:

command curl --location --silent $nvm_mirror/index.tab | command awk -v OFS=\t '
    /v0.9.12/ { exit } # Unsupported
    NR > 1 {
        print $1 (NR == 2  ? " latest" : $10 != "-" ? " lts/" tolower($10) : "")
    }
'
lkonya commented 3 years ago

@jorgebucaran I have no idea what changed, but it now works. Sorry for the false alarm. Thank you for your help!

If you encountered with this problem multiply time, maybe it could be mentioned in a FAQ?

jorgebucaran commented 3 years ago

This could happen if the user set nvm_mirror to an empty string. We now initialize nvm_mirror regardless, so the problem is less likely to reoccur.