Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

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

Open
eecolella opened this issue Jan 7, 2019 · 4 comments
Open

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

eecolella opened this issue Jan 7, 2019 · 4 comments
Labels

Comments

@eecolella
Copy link

eecolella commented Jan 7, 2019

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
@matchai
Copy link
Owner

matchai commented Jan 7, 2019

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
Copy link
Author

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.

@matchai matchai added Type: Bug Fix an existing bug Status: Available labels Jan 8, 2019
@matchai matchai changed the title Switching node version with nvm doesn't work Switching node version with omf plugin-nvm doesn't work Jan 8, 2019
@Snuggle
Copy link
Collaborator

Snuggle commented Jan 9, 2019

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
Copy link
Owner

matchai commented Jan 9, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants