nvm.fish: nvm install fails if ~/.local/share/nvm/ is missing

Hey Jorge

Love nvm.fish, just ran into minor trouble when doing a fresh install on manjaro arch 21.1, fish etc. is up to date.

maybe do a set -l d $HOME/.local/share/nvm; test -d $d; or mkdir -p $d 2>/dev/null on install to make sure …?

Thanks!

 ~ ↳ nvm install latest
warning: An error occurred while redirecting file '/home/USER/.local/share/nvm/.index.temp'
open: No such file or directory
nvm: Invalid index or unavailable host: "https://nodejs.org/dist"

 ~ ✗  mkdir .local/share/nvm

 ~ ↳  nvm install latest
Installing Node v16.7.0 latest
Fetching https://nodejs.org/dist/v16.7.0/node-v16.7.0-linux-x64.tar.gz
Now using Node v16.7.0 (npm 7.20.3) ~/.local/share/nvm/v16.7.0/bin/node

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Thanks for this thread, I just ran into this on Arch, been a loooong time since I used nvm/node on this box. But… I had the AUR nvm installed as well as jorgebucaran/nvm.fish installed with Fisher. I removed the nvm AUR package and then still had to fisher remove jorgebucaran/nvm.fish and then fisher install jorgebucaran/nvm.fish again to get nvm list-remotes to work without throwing this error in the OP.

Thanks!

@qodo-io I was able to reproduce this by deliberately removing $nvm_data, and trying to use nvm install.

That will cause nvm to fail, but you shouldn’t be missing $nvm_data as it’s created on install: https://github.com/jorgebucaran/nvm.fish/blob/8922519b432140e6eaafbb4dc397505c8da80139/conf.d/nvm.fish#L6

Maybe this happened because you were using an ancient nvm before we had lifecycle events, and got into a situation where you didn’t have $nvm_data but nvm installed.

@tuananh $nvm_data must exist after installing nvm. If it doesn’t, then your Fish could be broken.

Yep, i strictly followed the instructions on the readme