Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`bin_path': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) #9

Closed
agis opened this issue Oct 2, 2017 · 11 comments
Closed

Comments

@agis
Copy link

agis commented Oct 2, 2017

Hello.

I'm using overmind 1.0.8.2 and I'm running into the following issue (whereas hivemind works fine):

$ overmind s
system  | Listening at /Users/nick/foo/.overmind.sock
system  | Tmux session ID: overmind-foo-g3jF6FDXO09mWh6GsNV2UyIZQ1TQu5Km
webpack | Started with pid 26093...
rails   | Started with pid 26096...
rails   | /Users/agis/.rubies/ruby-2.3.3/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)
rails   |       from /Users/agis/.gem/ruby/2.3.3/bin/bundle:22:in `<main>'
rails   |
rails   | Exited
webpack | Interrupting...
webpack |
webpack | Exited

I'm using ruby 2.3 with chruby along with the relevant activation steps in my ~/.bash_profile, notably:

source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
chruby 2.3.3

I'm doing this from within an existing tmux session. However I also tried outside of a tmux session.

  • 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]
  • tmux 2.5
  • macOS 10.12.16
  • overmind 1.0.8.2 (installed with brew)
  • iTerm2 3.1.2

Again, hivemind works fine.

Thanks in advance!

@agis
Copy link
Author

agis commented Oct 2, 2017

After some digging around, it seems that commands spawned via launch do not inherit the environment of the process that spawned them (start in this case).

@DarthSim
Copy link
Owner

DarthSim commented Oct 2, 2017

Hi! It definitely should inherit the environment of the parent process. My teammates use different ruby version managers (rbenv, RVM, chruby), but no one has faced an issue like yours.

Could you check if the command works well when launched inside of tmux like that tmux new your_command?

Also, could you give me the output of gem env inside and outside of overmind?

@onemanstartup
Copy link

I had the same problems with gem_home. I migrate from gem_home (long time awaited) to direnv. That way every new shell exports right paths.

@agis
Copy link
Author

agis commented Dec 11, 2017

Apologies for the late reply.

gem env outside of overmind:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2
  - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-darwin15]
  - INSTALLATION DIRECTORY: /Users/agis/.gem/ruby/2.3.3
  - USER INSTALLATION DIRECTORY: /Users/agis/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/agis/.rubies/ruby-2.3.3/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/agis/.gem/ruby/2.3.3/bin
  - SPEC CACHE DIRECTORY: /Users/agis/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/agis/.rubies/ruby-2.3.3/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-15
  - GEM PATHS:
     - /Users/agis/.gem/ruby/2.3.3
     - /Users/agis/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["https://rubygems.org/"]
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/agis/.gem/ruby/2.3.3/bin
     - /Users/agis/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0/bin
     - /Users/agis/.rubies/ruby-2.3.3/bin
     - /Users/agis/dev/go/bin
     - /Applications/Postgres.app/Contents/MacOS/bin
     - /usr/local/Cellar/gettext/0.18.3.2/bin
     - /usr/local/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin

gem env inside overmind:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2
  - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-darwin15]
  - INSTALLATION DIRECTORY: /Users/agis/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: /Users/agis/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/agis/.rubies/ruby-2.3.3/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/agis/.rubies/ruby-2.3.3/bin
  - SPEC CACHE DIRECTORY: /Users/agis/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/agis/.rubies/ruby-2.3.3/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-15
  - GEM PATHS:
     - /Users/agis/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0
     - /Users/agis/.gem/ruby/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["https://rubygems.org/"]
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/agis/.gem/ruby/2.3.3/bin
     - /Users/agis/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0/bin
     - /Users/agis/.rubies/ruby-2.3.3/bin
     - /Users/agis/dev/go/bin
     - /Applications/Postgres.app/Contents/MacOS/bin
     - /usr/local/Cellar/gettext/0.18.3.2/bin
     - /usr/local/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin

and the diff:

$ diff no-overmind overmind
4c4
<   - INSTALLATION DIRECTORY: /Users/agis/.gem/ruby/2.3.3
---
>   - INSTALLATION DIRECTORY: /Users/agis/.rubies/ruby-2.3.3/lib/ruby/gems/2.3.0
7c7
<   - EXECUTABLE DIRECTORY: /Users/agis/.gem/ruby/2.3.3/bin
---
>   - EXECUTABLE DIRECTORY: /Users/agis/.rubies/ruby-2.3.3/bin
14d13
<      - /Users/agis/.gem/ruby/2.3.3
15a15
>      - /Users/agis/.gem/ruby/2.3.0

Running the command with tmux exits immediately, not sure if that should be the case:

$ tmux new bundle exec rails c
[exited]

Note that the command works when I'm already inside a tmux session (ie. tmux new and then bundle exec rails s).

@agis
Copy link
Author

agis commented Dec 11, 2017

Apparently my ~/.bash_profile (or ~/.bashrc even) aren't sourced with overmind. Changing the Procfile to do rails: source ~/.bash_profile && bundle exec rails s is a workaround, but unfortunately not a real solution.

@chall8908
Copy link

chall8908 commented Dec 12, 2017

@agis my first thought when seeing that is that tmux isn't starting a login shell (which, iirc, doesn't source those files normally). It may be possible to work around this by forcing tmux to use a login shell.

EDIT: I've been running into similar problems trying to set up overmind. I've been playing around with my tmux conf, but haven't gotten anywhere yet...

EDITx2: I think I might have found part of my problem. I use byobu normally and something about its tmux config must screw with Overmind. Oddly, my windows normally spawn a login shell but don't when using Overmind.

@DarthSim
Copy link
Owner

@agis @chall8908 Could you try the latest release?

@jbarreneche
Copy link

@DarthSim I had this issue too using chruby with the previous version of overmind if I tried to start 2 projects with different ruby. I updated to the latest version (1.1.0) and now it works correctly! Thanks!

@agis
Copy link
Author

agis commented Jan 11, 2018

The latest version works fine! Thanks!

@kaloyanxoxo
Copy link

Hello people , i'm having the same error, but i think it's caused by something else.

When i try to start my rails server , i get this :

 /Users/user/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems.rb:271:in 
  `find_spec_for_exe': can't find gem railties (>= 0.a) (Gem::GemNotFoundException)
  from /Users/user/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems.rb:299:in `activate_bin_path'
  from /Users/user/.rvm/gems/ruby-2.4.0/bin/rails:23:in `<main>'
  from /Users/user/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
  from /Users/user/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'

I thought it is because some wrong paths.When i call $PATH , it returns me:

/Users/user/.rvm/gems/ruby-2.4.0/bin:/Users/user/.rvm/gems/ruby-2.4.0@global/bin:/Users/user/.rvm/rubies/ruby-2.4.0/bin:/Users/user/.rvm/bin:/usr/local/bin:/.rvm/ruby-2.4.0/lib/ruby/2.4.0:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

when i check which ruby , it displays " /Users/user/.rvm/rubies/ruby-2.4.0/bin/ruby"

This is my GEM ENV paths, i hope some of them could help for the finding of a solution for the problem.

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.13
  - RUBY VERSION: 2.4.0 (2016-12-24 patchlevel 0) [x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Users/user/.rvm/gems/ruby-2.4.0
  - USER INSTALLATION DIRECTORY: /Users/user/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /Users/user/.rvm/rubies/ruby-2.4.0/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/user/.rvm/gems/ruby-2.4.0/bin
  - SPEC CACHE DIRECTORY: /Users/user/.rvm/gems/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/user/.rvm/rubies/ruby-2.4.0/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-16
  - GEM PATHS:
     - /Users/user/.rvm/gems/ruby-2.4.0
     - /Users/user/.rvm/gems/ruby-2.4.0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/user/.rvm/gems/ruby-2.4.0/bin
     - /Users/user/.rvm/gems/ruby-2.4.0@global/bin
     - /Users/user/.rvm/rubies/ruby-2.4.0/bin
     - /Users/user/.rvm/bin
     - /usr/local/bin
     - /.rvm/ruby-2.4.0/lib/ruby/2.4.0
     - /usr/local/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin

I looked through every article i find in stackoverflow and there is nothing i could find to remove my problem...

I use macOS Sierra 10.12

P.S Sorry for my bad formatting of the code.

@mhenrixon
Copy link

#127 seems related to this issue!

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

No branches or pull requests

7 participants