How to fix "undefined method `name' for Array" error when running bundled commands on Ruby 1.8.7 + Rails 2.3

Updated . Posted . Visible to the public.

On recent/fresh installations of Ruby 1.8.7 you may encounter this error why calling any bundled binary (or just bundle exec):

/home/arne/.rvm/gems/ruby-1.8.7-p374@global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup': undefined method `name' for #<Array:0x7fe04783ef30> (NoMethodError)
  from /home/arne/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `map'
  ...

Apparently, this is due to bundler (or maybe the rubygems-bundler that RVM supplies by default) no longer working on old Rails versions (it seems to work on applications running on Rails 3.2 + Ruby 1.8.7).

The somewhat ugly solution is to remove that global rubygems-bundler, and install it again "locally":

rvm @global
gem uninstall rubygems-bundler
rvm @ # this might or might not work for you. alternatively, try "cd ."
gem install rubygems-bundler

You will get the same version of the gem, but your bundled binaries will now work again. \
Not installing rubygems-bundler after uninstallation can also be an option. See if your project works without it.

Run gem list -d rubygems-bundler to confirm it does not live in your @global gemset.

Profile picture of Arne Hartherz
Arne Hartherz
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2013-12-20 09:30)