nvm fix to work for other shells #430

danielb2 opened this Issue Jun 4, 2014 · 6 comments


None yet

2 participants

danielb2 commented Jun 4, 2014

I'm using fish-shell and I'm unable to use nvm as it stands.

However, with a wrapper file cat nvm:


if [[ -s $HOME/.nvm/nvm.sh ]] ;
    source $HOME/.nvm/nvm.sh;
    echo "No nvm found in `$HOME/.nvm/nvm.sh`";

nvm $@

I can easily use it. However, it does not set the PATH.

Setting the default node could easily be accomplished if a .nvm/default pointed to the default version. For example, .nvm/default -> v0.10.28/

I suggest that nvm alias default 0.10.28 create such a link as then I could easily alter my path to include .nvm/default/bin


Were there any thoughts on this? I'd like to be able to use other shells easily with this.

ljharb commented Jun 23, 2014

fish is the only shell that it doesn't work with, and it's so vastly different from other POSIX-compliant shells that there's not going to be a fast solution. You can look into https://github.com/Alex7Kom/nvm-fish for the time being as well.


Yes, but wouldn't my solution work for all shells? since it uses a bash wrapper? And isn't that a better solution as it's generic?

ljharb commented Jun 24, 2014

Your approach would re-source nvm.sh on every call to nvm - that doesn't seem like the approach we want here.

I'd be OK with nvm alias default (and only default) creating a symlink in ~/.nvm - as well as nvm use creating a symlink under ~/.nvm/current. Please feel free to submit (separate) PRs for those if you're interested!


OK, will do. One of the issues I had was actually that nvm tended to pollute my path in bash. I'll have a look at implementing it


See PR here: #447

I wasn't sure what to do for a test though.

@ljharb ljharb added the shell: fish label Jul 9, 2014
@ljharb ljharb closed this in 8f66273 Jul 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment