jedi
jedi

Reputation: 2198

Bundler installed but errors out saying it is not installed

I'm using RVM, currently I'm using ruby 2.7.4

rvm current
ruby-2.7.4

I installed bundler -v 2.2.26 as default

gem install bundler -v2.2.26 --default
gem info bundler
*** LOCAL GEMS ***

bundler (2.2.26)
    Authors: André Arko, Samuel Giddins, Colby Swandale, Hiroshi
    Shibata, David Rodríguez, Grey Baker, Stephanie Morillo, Chris
    Morris, James Wen, Tim Moore, André Medeiros, Jessica Lynn Suttles,
    Terence Lee, Carl Lerche, Yehuda Katz
    Homepage: https://bundler.io
    License: MIT
    Installed at (default): /Users/jedrek/.rvm/rubies/ruby-2.7.4/lib/ruby/gems/2.7.0

When I check the location of the gem, it is not there.

ls /Users/jedrek/.rvm/rubies/ruby-2.7.4/lib/ruby/gems/2.7.0/gems
# no bundler gem

When I try to bundle my gems in my project I get an error

Traceback (most recent call last):
    3: from /Users/jedrek/.rvm/gems/ruby-2.7.4/bin/ruby_executable_hooks:22:in `<main>'
    2: from /Users/jedrek/.rvm/gems/ruby-2.7.4/bin/ruby_executable_hooks:22:in `eval'
    1: from /Users/jedrek/.rvm/gems/ruby-2.7.4/bin/bundle:23:in `<main>'
/Users/jedrek/.rvm/gems/ruby-2.7.4/bin/bundle:23:in `load': cannot load such file -- /Users/jedrek/.rvm/rubies/ruby-2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.2.26/exe/bundle (LoadError)

Where is my gem? What's going on?

Upvotes: 1

Views: 2711

Answers (1)

lacostenycoder
lacostenycoder

Reputation: 11216

Depending on if you have multiple projects on your system, when using RVM you may want to look into using gem sets as this can help with using correct versions when switching between project. However if you don't care about that, you can try uninstall the gem, then reinstall the version you want.

gem uninstall bundler # should uninstall all versions besides

#either of these two work the same
gem install bundler:2.2.26 
gem install bundler -v2.2.26

Personally I switched from using RVM to Chruby quite some time ago and have had far fewer issues like the one you described here.

Upvotes: 2

Related Questions