4
votes

I am having a strange issue where when I try and run vagrant up the system can suddenly not find the json gem. When I run vagrant up I get this message:

/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find  json (~> 1.5.1) amongst [Platform-0.4.0, archive-tar-minitar-0.5.2, builder-3.0.0,  bundler-1.1.5, childprocess-0.3.5, cucumber-1.2.1, diff-lcs-1.1.3, erubis-2.7.0, ffi-1.1.5, gemcutter-0.7.1, gherkin-2.11.2, git-1.2.5, hiera-0.3.0, hiera-json-0.3.0, hiera-puppet-0.3.0, highline-1.6.13, i18n-0.6.0, json-1.7.5, log4r-1.1.10, metaclass-0.0.1, mocha-0.12.3, net-scp-1.0.4, net-ssh-2.5.2, open4-1.3.0, popen4-0.1.2, progressbar-0.11.0, puppet-module-0.3.4, puppetlabs_spec_helper-0.3.0, rake-0.9.2.2, rspec-2.11.0, rspec-core-2.11.1, rspec-expectations-2.11.2, rspec-mocks-2.11.2, rspec-puppet-0.1.4, thor-0.16.0, vagrant-1.0.3, veewee-0.2.3, virtualbox-0.9.2] (Gem::LoadError)
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:771:in `activate_dependencies'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:760:in `each'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:760:in `activate_dependencies'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:744:in `activate'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1209:in `gem'
        from /usr/local/bin/vagrant:18

As you can see from the error above the json gem is clearly in the list, yet it will not recognize it. I have searched for this issue and found many occurrences but most of the time the gem is not present in the amongst list. I do not have ruby installed multiple times and the gem path is set.

gem env

RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.15
  • RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  • INSTALLATION DIRECTORY: /var/lib/gems/1.8
  • RUBY EXECUTABLE: /usr/bin/ruby1.8
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /var/lib/gems/1.8
    • /home/adrian/.gem/ruby/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

The installation directories are default on Ubuntu 12.04.

gem list

* LOCAL GEMS *

archive-tar-minitar (0.5.2)
builder (3.0.0)
bundler (1.1.5)
childprocess (0.3.5)
cucumber (1.2.1)
diff-lcs (1.1.3)
erubis (2.7.0)
ffi (1.1.5)
gemcutter (0.7.1)
gherkin (2.11.2)
git (1.2.5)
hiera (0.3.0)
hiera-json (0.3.0)
hiera-puppet (0.3.0)
highline (1.6.13)
i18n (0.6.0)
json (1.7.5)
log4r (1.1.10)
metaclass (0.0.1)
mocha (0.12.3)
net-scp (1.0.4)
net-ssh (2.5.2)
open4 (1.3.0)
Platform (0.4.0)
popen4 (0.1.2)
progressbar (0.11.0)
puppet-module (0.3.4)
puppetlabs_spec_helper (0.3.0)
rake (0.9.2.2)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
rspec-mocks (2.11.2)
rspec-puppet (0.1.4)
thor (0.16.0)
vagrant (1.0.3)
veewee (0.2.3)
virtualbox (0.9.2)

As you can see the gem is in the installed list here to. The environment variables $GEM_HOME and $GEM_PATH are not set.

I have been trying to figure this one out but am currently at a loss. Any help from a Ruby and/or Vagrant expert would be greatly appreciated.

1

1 Answers

4
votes

As you pointed here, you have already installed json gem version 1.7.5. But the error message you are getting states Could not find json (~> 1.5.1). The ~> syntax means that only 1.5.x versions are acceptable! So, you need to install one of these to satisfy the dependencies.