matchai / spacefish

🚀🐟 The fish shell prompt for astronauts
https://spacefish.matchai.dev
MIT License
960 stars 78 forks source link

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

Open eecolella opened 5 years ago

eecolella commented 5 years ago

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

matchai commented 5 years ago

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?

eecolella commented 5 years ago

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.

Snuggle commented 5 years ago

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?

matchai commented 5 years ago

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. 🤔