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

GemNotFoundException when not using default ruby as specified by rvm #133

Closed
jared-thoughtbot opened this issue Jun 23, 2022 · 4 comments
Closed

Comments

@jared-thoughtbot
Copy link

Problem

When using rvm and trying to run overmind start it fails with Could not find 'bundler' (1.17.3) required by your /home/jaredt/projects/maitre-d/Gemfile.lock. (Gem::GemNotFoundException).

I seem to have narrowed this down to when using rvm and having the necessary ruby version installed and in use, but it not being the default rvm ruby.

Steps to reproduce

  • Install rvm
  • Install 2 ruby versions eg. 2.6.9 and 2.7.5
  • Set one of the versions to default eg. rvm --default use 2.7.5
  • Open application that uses the non-default version (eg. 2.6.9)
  • Confirm the ruby version rvm is using is correct ruby -v and which ruby
  • Confirm you can run the app directly eg. rails server
  • Try overmind start

What you expected to see

The various services start up

What you saw instead

$ overmind start
system | Tmux socket name: overmind-maitre-d-HcwVIZlk8gsSWMQNOnGyTf
system | Tmux session ID: maitre-d
system | Listening at ./.overmind.sock
web    | Started with pid 15814...
worker | Started with pid 15816...
web    | Traceback (most recent call last):
web    |        4: from /home/jaredt/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `<main>'
web    |        3: from /home/jaredt/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `eval'
web    |        2: from /home/jaredt/.rvm/gems/ruby-2.7.5/bin/bundle:23:in `<main>'
web    |        1: from /home/jaredt/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:296:in `activate_bin_path'
web    | /home/jaredt/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': Could not find 'bundler' (1.17.3) required by your /home/jaredt/projects/maitre-d/Gemfile.lock. (Gem::GemNotFoundException)
web    | To update to the latest version installed on your system, run `bundle update --bundler`.
web    | To install the missing version, run `gem install bundler:1.17.3`
worker | Traceback (most recent call last):
worker |        4: from /home/jaredt/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `<main>'
worker |        3: from /home/jaredt/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `eval'
worker |        2: from /home/jaredt/.rvm/gems/ruby-2.7.5/bin/bundle:23:in `<main>'
worker |        1: from /home/jaredt/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:296:in `activate_bin_path'
worker | /home/jaredt/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': Could not find 'bundler' (1.17.3) required by your /home/jaredt/projects/maitre-d/Gemfile.lock. (Gem::GemNotFoundException)
worker | To update to the latest version installed on your system, run `bundle update --bundler`.
worker | To install the missing version, run `gem install bundler:1.17.3`
web    | Exited
worker | Exited

Notes

  • Notice that it's using a different ruby version to what was confirmed above
  • Use rvm list to confirm the other ruby version is installed and it's the default
  • Try setting the application ruby version to be rvm's default eg. rvm --default use 2.6.9
  • Retry overmind start
  • It works! :)
@denys-chaikovskyi
Copy link

Having similar issue. Getting error when running overmind start

Your Ruby version is 3.1.2, but your Gemfile specified 2.7.4

while having the current version pointed to 2.7.4

Seems like overmind use default instead of the current version of ruby.

Changing rvm default version to the needed version resolves the problem. @jared-thoughtbot, thanks for the suggested workaround.

@DarthSim
Copy link
Owner

DarthSim commented Jun 28, 2022

Sorry, can't reproduce this :( Here's my shell output:

$ rvm list
=> ruby-2.7.6 [ arm64 ]
 * ruby-3.1.2 [ arm64 ]

# => - current
# =* - current && default
#  * - default

$ ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin21]

$ which ruby
/Users/darthsim/.rvm/rubies/ruby-2.7.6/bin/ruby

$ ./overmind s -f Procfile.test
system     | Tmux socket name: overmind-overmind-bNgYagaY6ln9AuE5FxSDy
system     | Tmux session ID: overmind
system     | Listening at ./.overmind.sock
ruby-v     | Started with pid 49572...
which-ruby | Started with pid 49573...
ruby-v     | ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin21]
which-ruby | /Users/darthsim/.rvm/rubies/ruby-2.7.6/bin/ruby
ruby-v     | Exited
which-ruby | Interrupting...
which-ruby | Exited

As you can see, the current Ruby version differs from the default one yet Overmind uses the current version as expected.

On a very basic level, Overmind doesn't do anything fancy but run tmux with commands from the Procfile. You can emulate the same behavior without Overmind involved:

  1. Create a test script: echo -e "#\!/bin/sh\nruby -v\nwhich ruby\nsleep 10" > ruby-test.sh
  2. Make it executable: chmod +x ruby-test.sh
  3. Run a new tmux server with it: tmux -L rubytest new ./ruby-test.sh

If it shows the wrong version too then Overmind is not a cause and you need to check your RVM installation.

@jared-thoughtbot
Copy link
Author

Thanks for taking the time to investigate this!

I can confirm I'm seeing the wrong version when testing using your simplified script.

I am using fish shell so maybe there's something in the rvm config that's not right. I'll close this for now. Cheers!

@denys-chaikovskyi
Copy link

@jared-thoughtbot I also have this issue on the fish shell. Probably something with fish configs 🤔

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

3 participants