Vagrant: Cannot install plugin: undefined method `group_by' for nil:NilClass

Created on 21 Jan 2016  ยท  17Comments  ยท  Source: hashicorp/vagrant

When I try to install a vagrant plugin, a nilclass exception is raised:

$ vagrant plugin install vagrant-libvirt 
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
/usr/local/lib/site_ruby/2.1.0/rubygems/specification.rb:945:in `all=': undefined method `group_by' for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:275:in `with_isolated_gem'
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:231:in `internal_install'
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:97:in `install'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:62:in `block in install_plugin'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:72:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:72:in `install_plugin'
    from /usr/share/vagrant/plugins/commands/plugin/action/install_gem.rb:37:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/warden.rb:34:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/builder.rb:116:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `block in run'
    from /usr/lib/ruby/vendor_ruby/vagrant/util/busy.rb:19:in `busy'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/plugins/commands/plugin/command/base.rb:14:in `action'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:32:in `block in execute'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `each'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `execute'
    from /usr/share/vagrant/plugins/commands/plugin/command/root.rb:56:in `execute'
    from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in `execute'
    from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:267:in `cli'
    from /usr/bin/vagrant:173:in `<main>'

It has been run on a debian jessie with ruby 2.1.5p273 and vagrant 1.6.5

bug core waiting-reply

Most helpful comment

This issue is present with Vagrant 1.8.1 and Ruby 2.3.0.

All 17 comments

Hi @reaper

Vagrant 1.6.5 is very old. Could you please upgrade to Vagrant 1.8.1 using the official installers on https://www.vagrantup.com/downloads.html? Please do not install via your system package manager.

Thank you it works !

This issue is present with Vagrant 1.8.1 and Ruby 2.3.0.

After upgrading to Ubuntu 16.04, I have this issue. It has Vagrant 1.8.1 and Ruby 2.3.0.

Using this patch worked for me: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818237#28

Same issue as with @jecompton; bug is present on Vagrant 1.8.1+dfsg-1 with Ruby 1:2.3.0+1 from the Xenial repo. The indicated patch does appear to work around the issue.

This fixed also the issue when the _vagrant-triggers_ plugin is installed during vagrant up.

after applying the patch and running vagrant up, I now get this error:

==> default:  * Restarting nginx nginx
==> default:    ...done.
==> default: Running triggers after up...
==> default: Executing command "vagrant ssh -c vagrant_up"...
==> default: /usr/lib/ruby/vendor_ruby/bundler.rb:163:in `rescue in root': Could not locate Gemfile or .bundle/ directory (Bundler::GemfileNotFound)
==> default:    from /usr/lib/ruby/vendor_ruby/bundler.rb:159:in `root'
==> default:    from /usr/lib/ruby/vendor_ruby/bundler.rb:71:in `bundle_path'
==> default:    from /usr/lib/ruby/vendor_ruby/bundler.rb:419:in `configure_gem_home'
==> default:    from /usr/lib/ruby/vendor_ruby/bundler.rb:407:in `configure_gem_home_and_path'
==> default:    from /usr/lib/ruby/vendor_ruby/bundler.rb:57:in `configure'
==> default:    from /usr/lib/ruby/vendor_ruby/bundler.rb:118:in `definition'
==> default:    from /usr/lib/ruby/vendor_ruby/bundler.rb:88:in `setup'
==> default:    from /usr/bin/vagrant:75:in `<main>'
==> default: Command execution finished.
The local command "vagrant ssh -c 'vagrant_up'" returned a failed exit
code or an exception. The error output is shown below:

/usr/lib/ruby/vendor_ruby/bundler.rb:163:in `rescue in root': Could not locate Gemfile or .bundle/ directory (Bundler::GemfileNotFound)
    from /usr/lib/ruby/vendor_ruby/bundler.rb:159:in `root'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:71:in `bundle_path'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:419:in `configure_gem_home'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:407:in `configure_gem_home_and_path'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:57:in `configure'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:118:in `definition'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:88:in `setup'
    from /usr/bin/vagrant:75:in `<main>'

I'm seeing this on 16.04 with fresh install of Vagrant 1.8.1 when installing the vagrant-triggers plugin. Is the patch the only way around it?

I am getting a similar error with Ubuntu 16.04 Vagrant 1.8.1 and ruby 2.3.0p0

Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
/usr/lib/ruby/2.3.0/rubygems/specification.rb:946:in `all=': undefined method `group_by' for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:275:in `with_isolated_gem'
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:231:in `internal_install'
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:102:in `install'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:62:in `block in install_plugin'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:72:in `install_plugin'
    from /usr/share/vagrant/plugins/commands/plugin/action/install_gem.rb:37:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/warden.rb:34:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/builder.rb:116:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `block in run'
    from /usr/lib/ruby/vendor_ruby/vagrant/util/busy.rb:19:in `busy'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/plugins/commands/plugin/command/base.rb:14:in `action'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:32:in `block in execute'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `each'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `execute'
    from /usr/share/vagrant/plugins/commands/plugin/command/root.rb:56:in `execute'
    from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in `execute'
    from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:268:in `cli'
    from /usr/bin/vagrant:173:in `<main>'

Updated to Vagrant 1.8.4 and the issue is fixed now. Was able to load VVV without issue and access the local sites through Chrome.

Updated to 1.8.4 and it works too.

Updated to Vagrant 1.9.1 and it works too.

FYI, I managed to get it working after applying the patch in Vagrant version 1.8.1. The referred answer can be found here.

Good instructions on updating Vagrant on Ubuntu here - https://github.com/openebs/openebs/issues/32

Would be very helpful if apt-get would install latest.

I have this problem with Vagrant 1.8.1 and Ruby 2.3.1.

All installed on Linux Mint 18.2 with the package manager.

updated to the 1.9.1 .deb here : https://releases.hashicorp.com/vagrant/1.9.1/vagrant_1.9.1_x86_64.deb

seems to work ok. Ubuntu / Mint are offering an old version for the package manager.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cbeck527 picture Cbeck527  ยท  3Comments

jazzfog picture jazzfog  ยท  3Comments

luispabon picture luispabon  ยท  3Comments

DreadPirateShawn picture DreadPirateShawn  ยท  3Comments

tomhking picture tomhking  ยท  3Comments