nvm fix to work for other shells #430

Closed
danielb2 opened this Issue Jun 4, 2014 · 6 comments

Projects

None yet

2 participants

@danielb2
Contributor
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:

#!/bin/bash

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

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

@danielb2
Contributor

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

@ljharb
Collaborator
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.

@danielb2
Contributor

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
Collaborator
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!

@danielb2
Contributor

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

@danielb2
Contributor

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