wbyoung / avn

Automatic Version Switching for Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

avn could not activate node

assimovt opened this issue · comments

I know this has been already discussed, but I am still bumping into this:

$ cd test/
avn could not activate node 5.12.0
$ cat .node-version
5.12.0
$ nvm list
       v0.10.46
       v0.12.15
        v5.12.0
->       v6.5.0
default -> 6.5.0 (-> v6.5.0)
node -> stable (-> v6.5.0) (default)
stable -> 6.5 (-> v6.5.0) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.5.0 (-> N/A)

Details

  • avn 0.2.3
  • node v6.5.0
  • nvm 0.31.7
  • bash GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)

The output of __avn_debug in the directory with a .node-version file is:

avn could not activate node 5.12.0
error: no plugin passed predicate
  avn-nvm: Bad argument

avn is loaded in my ~/.bash_profile file with:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
[[ -s "$HOME/.avn/bin/avn.sh" ]] && source "$HOME/.avn/bin/avn.sh" # load avn

nvm specific

  • As an nvm user I am confirming that I did not install with Homebrew

@assimovt have you taken a look at #25? What solutions have you tried and did they get you anywhere?

@hiimtaylorjones Yep, I did look at it and done everything as described, but nothing helped. Any other ideas?

The closest environment in which I can attempt to reproduce this has only this change:

  • bash GNU bash, version 4.4.0(1)-release (x86_64-apple-darwin15.6.0)

Everything's working as expected, though.

If you're open to it, the best way to resolve this would be to start adding debugging output to the code (you can edit it right in ~/.avn, specifically ~/.avn/plugins/avn-nvm and running __avn_debug (if you're editing shell files you'll need to re-source ~/.avn/bin/avn.sh as well).

@wbyoung sure, let's debug it. I am actually running it in Docker container, based on buildpack-deps:jessie. Please let me know what lines to edit.

Start here. That file is pretty small, so if the error is in there, it shouldn't be too hard to understand & track down. You may need to log to a file if nothing shows up using console, but you may be fine.

@wbyoung Alright. Thanks for the tip. I found the problem. The SHELL is not set in the Docker image and the line here https://github.com/wbyoung/avn-nvm/blob/master/index.js#L23 fails. Maybe would be good to add it to the doc or handle error nicely? What do you think? Cheers.

Yeah, both sound smart. Want to send a PR?

I am not familiar with the internals, however is this a good place where we could check if SHELL is set? avn.sh#L9