[solved] cannot load such file — rubygems/format (LoadError)

require’: cannot load such file — rubygems/format (LoadError)

 ➜ appsurfer git:(master) knife cookbook
 zsh: correct 'cookbook' to 'cookbooks' [nyae]? n
 /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/provider/package/rubygems.rb:34:in `require': cannot load such file -- rubygems/format (LoadError)
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/provider/package/rubygems.rb:34:in `'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/providers.rb:60:in `require'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/providers.rb:60:in `'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef.rb:25:in `require'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef.rb:25:in `'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chefspec-1.3.0/lib/chefspec.rb:1:in `require'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chefspec-1.3.0/lib/chefspec.rb:1:in `'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chefspec-1.3.0/lib/chef/knife/cookbook_create_specs.rb:1:in `require'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chefspec-1.3.0/lib/chef/knife/cookbook_create_specs.rb:1:in `'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/knife/core/subcommand_loader.rb:37:in `load'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/knife/core/subcommand_loader.rb:37:in `block in load_commands'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/knife/core/subcommand_loader.rb:37:in `each'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/knife/core/subcommand_loader.rb:37:in `load_commands'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/knife.rb:119:in `load_commands'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/knife.rb:167:in `run'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/lib/chef/application/knife.rb:123:in `run'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.4.4/bin/knife:25:in `'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/bin/knife:23:in `load'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/bin/knife:23:in `'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `eval'
 from /home/arun/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `'

the gem environment looked like this

 ➜ appsurfer git:(master) gem env
 RubyGems Environment:
 - RUBYGEMS VERSION: 2.0.3
 - RUBY VERSION: 2.0.0 (2013-05-14 patchlevel 195) [x86_64-linux]
 - INSTALLATION DIRECTORY: /home/arun/.rvm/gems/ruby-2.0.0-p195
 - RUBY EXECUTABLE: /home/arun/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
 - EXECUTABLE DIRECTORY: /home/arun/.rvm/gems/ruby-2.0.0-p195/bin
 - RUBYGEMS PLATFORMS:
 - ruby
 - x86_64-linux
 - GEM PATHS:
 - /home/arun/.rvm/gems/ruby-2.0.0-p195
 - /home/arun/.rvm/gems/ruby-2.0.0-p195@global
 - GEM CONFIGURATION:
 - :update_sources => true
 - :verbose => true
 - :backtrace => false
 - :bulk_threshold => 1000
 - REMOTE SOURCES:
 - https://rubygems.org/

Solution: i finally found that it’s neither ruby or chef’s fault but a problem with rubygems. so if you downgrade or use rubygems 1.8.25, everything works perfectly fine.

 ➜ appsurfer git:(master) rvm rubygems 1.8.25
 Retrieving rubygems-1.8.25
 Extracting rubygems-1.8.25 ...
 Removing old Rubygems files...
 Installing rubygems-1.8.25 for ruby-2.0.0-p195.....................
 Installation of rubygems completed successfully.

and then switch it to use that rubygems.

echo "rubygems_version=latest-1.8.25" >> $rvm_path/user/db

exit the shell and open new shell and test the settings. you should see something like this

 ➜ appsurfer git:(master) gem env
 RubyGems Environment:
 - RUBYGEMS VERSION: 1.8.25
 - RUBY VERSION: 2.0.0 (2013-05-14 patchlevel 195) [x86_64-linux]
 - INSTALLATION DIRECTORY: /home/arun/.rvm/gems/ruby-2.0.0-p195
 - RUBY EXECUTABLE: /home/arun/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
 - EXECUTABLE DIRECTORY: /home/arun/.rvm/gems/ruby-2.0.0-p195/bin
 - RUBYGEMS PLATFORMS:
 - ruby
 - x86_64-linux
 - GEM PATHS:
 - /home/arun/.rvm/gems/ruby-2.0.0-p195
 - /home/arun/.rvm/gems/ruby-2.0.0-p195@global
 - GEM CONFIGURATION:
 - :update_sources => true
 - :verbose => true
 - :benchmark => false
 - :backtrace => false
 - :bulk_threshold => 1000
 - REMOTE SOURCES:
 - http://rubygems.org/

2 Responses to “[solved] cannot load such file — rubygems/format (LoadError)”

Leave a Reply