matchai/spacefish

Switching node version with omf plugin-nvm doesn't work

eecolella opened this issue · 4 comments

Bug Report

Current Behavior
image

"nvm use" has no effect

Expected Behavior
"nvm use" should change node version
It is working with any theme, except spacefish

Environment

  • Spacefish version: 1.12.4
  • Fish version: 3.0.0
  • Fish plugin manager: oh-my-fish
  • Terminal emulator: Hyper
  • Operating system: OSX 10.14.2

Hey @eecolella. Thanks for opening an issue! 😄
Can you share what solution you're using for nvm to work with fish?
Are you using a compatibility wrapper like https://github.com/FabioAntunes/fish-nvm, or have you set your $NVM_DIR manually?

Hi @matchai,
I was using https://github.com/derekstavis/plugin-nvm via omf.
Switching to https://github.com/FabioAntunes/fish-nvm via fisher is now working fine.

I'm lost here.
image

In both the top and bottom, the version being used is v10.15.0? How is this a Spacefish issue, wouldn't this be an nvm issue? What are the wrappers above for, too? nvm is a bash script, https://github.com/creationix/nvm, why is a wrapper necessary?

The reason a wrapper is often used is because it's a bash script, so you would have to source nvm using something like bass.

Here is the conventional startup script, which fish-nvm uses:

bass source $nvm_prefix/nvm.sh --no-use ';' nvm $argv

The reason some nvm wrappers show the symbol and not others is because some don't use nvm directly and instead emulate nvm, like brigand/fast-nvm-fish, which is admittedly faster than actually using nvm, but doesn't alter NVM_BIN. This causes the version to not update since we cache the nvm version based on whether NVM_BIN has updated (what is happening in the screenshot).

What we need is a better fallback to node -v when we don't get a version value from nvm. At the moment we simply don't update it.

It might be worth creating an issue to go ahead and test several nvm wrappers to installation methods and write tests for them to ensure compatibility. 🤔