Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Bug with Ruby 2.0:`require': cannot load such file -- rubygems/format (LoadError) #2204

Closed
SixArm opened this issue Dec 5, 2012 · 13 comments

Comments

@SixArm
Copy link

SixArm commented Dec 5, 2012

Bug using the new Bundler (1.2.3) and new Ruby (2.0.0 Preview 2 MRI) and gem. Stack trace below.

Bundler is trying to require 'rubygems/format' but that file does not seem to exist in Ruby 2.

Editing the Bundler source code to comment out the require line does help-- but there's a subsequent bug. See below.

$ /opt/ruby/2/lib/ruby/gems/bin/bundle install                             
/opt/ruby/2.0.0-preview2/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- rubygems/format (LoadError)
       /opt/ruby/2.0.0-preview2/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/source.rb:5:in `'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/dsl.rb:21:in `initialize'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/dsl.rb:6:in `new'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/dsl.rb:6:in `evaluate'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/definition.rb:18:in `build'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler.rb:144:in `definition'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/cli.rb:228:in `install'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/vendor/thor/task.rb:27:in `run'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/vendor/thor.rb:275:in `dispatch'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/vendor/thor/base.rb:408:in `start'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/bin/bundle:14:in `block in '
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/friendly_errors.rb:4:in `with_friendly_errors'
       /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/bin/bundle:14:in `'
       /opt/ruby/2/lib/ruby/gems/bin/bundle:23:in `load'
       /opt/ruby/2/lib/ruby/gems/bin/bundle:23:in `'

Diagnostics: where is the rubygems/format file in Ruby 1.9.3 vs. Ruby 2.0.0?

$ find /opt/ruby/1.9.3-p194 | grep rubygems/format
/opt/ruby/1.9.3-p194/lib/ruby/1.9.1/rubygems/format.rb
/opt/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rubygems-update-1.8.24/lib/rubygems/format.rb
/opt/ruby/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/format.rb

$ find /opt/ruby/2.0.0-preview2 | grep rubygems/format
(nothing found)

My setup:

$ ruby -v                         
ruby 2.0.0dev (2012-12-01 trunk 38126) [x86_64-linux]

$ bundle -v
Bundler version 1.2.3

$ gem -v   
2.0.0.preview2

$ echo $GEM_HOME
/opt/ruby/2.0.0-preview2/lib/ruby/gems

$ echo $GEM_PATH         
/opt/ruby/2.0.0-preview2/lib/ruby/gems

In case it's helpful to know:

  • this setup does not use rvm, nor rbenv, nor any kind of shims.
  • this same kind of setup works fine with the current Ruby 1.9.3.

Perhaps notable: when I comment out the Bundler line "require 'rubygems/format', that does help some. Bundler fetches some metadata, then crashes trying fetch all remote specs.

$ /opt/ruby/2/lib/ruby/gems/bin/bundle install        
Fetching git://github.com/freerange/mocha.git
remote: Counting objects: 7025, done.
remote: Compressing objects: 100% (1873/1873), done.
remote: Total 7025 (delta 5193), reused 6891 (delta 5088)
Receiving objects: 100% (7025/7025), 1.27 MiB | 270 KiB/s, done.
Resolving deltas: 100% (5193/5193), done.
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from http://gems.github.com/.
Fetching full source index from http://gems.github.com/
Unfortunately, a fatal error has occurred. Please see the Bundler 
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/fetcher.rb:206:in `fetch_all_remote_specs': undefined method `list' for # (NoMethodError)
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/fetcher.rb:89:in `rescue in specs'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/fetcher.rb:72:in `specs'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/source.rb:234:in `block in remote_specs'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/source.rb:232:in `each'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/source.rb:232:in `remote_specs'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/source.rb:165:in `fetch_specs'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/source.rb:70:in `specs'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/definition.rb:191:in `block (2 levels) in index'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/definition.rb:188:in `each'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/definition.rb:188:in `block in index'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/index.rb:9:in `build'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/definition.rb:184:in `index'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/definition.rb:178:in `resolve'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/definition.rb:113:in `specs'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/definition.rb:108:in `resolve_remotely!'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/installer.rb:81:in `run'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/installer.rb:14:in `install'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/cli.rb:230:in `install'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/vendor/thor/task.rb:27:in `run'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/vendor/thor.rb:275:in `dispatch'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/vendor/thor/base.rb:408:in `start'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/bin/bundle:14:in `block in '
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/lib/bundler/friendly_errors.rb:4:in `with_friendly_errors'
    from /opt/ruby/2.0.0-preview2/lib/ruby/gems/gems/bundler-1.2.3/bin/bundle:14:in `'
    from /opt/ruby/2/lib/ruby/gems/bin/bundle:23:in `load'
    from /opt/ruby/2/lib/ruby/gems/bin/bundle:23:in `'
@indirect
Copy link
Member

indirect commented Dec 5, 2012

1.2.3 is not compatible with the 2.0 prerelease versions of Ruby or Rubygems. Please install the Bundler 1.3.0 prerelease by running gem install bundler --pre.

@auzias
Copy link

auzias commented Mar 6, 2015

I had a similar issue:

$rails server
/usr/local/lib/ruby/gems/2.2.0/gems/byebug-3.5.1/lib/byebug/history.rb:1:in `require': cannot load such file -- readline (LoadError)
        from /usr/local/lib/ruby/gems/2.2.0/gems/byebug-3.5.1/lib/byebug/history.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/gems/2.2.0/gems/byebug-3.5.1/lib/byebug/interface.rb:1:in `require'
        from /usr/local/lib/ruby/gems/2.2.0/gems/byebug-3.5.1/lib/byebug/interface.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/gems/2.2.0/gems/byebug-3.5.1/lib/byebug/core.rb:5:in `require'
        from /usr/local/lib/ruby/gems/2.2.0/gems/byebug-3.5.1/lib/byebug/core.rb:5:in `<top (required)>'
        from /usr/local/lib/ruby/gems/2.2.0/gems/byebug-3.5.1/lib/byebug.rb:1:in `require'
        from /usr/local/lib/ruby/gems/2.2.0/gems/byebug-3.5.1/lib/byebug.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:76:in `require'
        from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:72:in `each'
        from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:72:in `block in require'
        from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:61:in `each'
        from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:61:in `require'
        from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler.rb:134:in `require'
        from /home/auzias/perso/howdy/config/application.rb:7:in `<top (required)>'
        from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
        from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
        from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:8:in `require'
        from bin/rails:8:in `<main>'

I had to comment gem 'byebug' to get it working 👍

My setup:

$ ruby -v             
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

$ bundle -v
Bundler version 1.8.4

$ gem -v   
2.4.5

@skutondo
Copy link

Has anyone run into the same issue with OSX El Capitan?

@skutondo
Copy link

Here is my error with El Capitan:

rails server
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- bundler/setup (LoadError) from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /Users/Sam_k/mynewapp/config/boot.rb:3:in <top (required)>' from bin/rails:3:inrequire_relative'
from bin/rails:3:in `

'

My Setup:

$ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]

$ bundle -v
Bundler version 1.10.6

$ gem -v
2.4.5.1

@indirect
Copy link
Member

@skutondo this issue is both fixed and closed. If you are having an issue you would like to report, please follow ISSUES.

@skutondo
Copy link

Yes, Andre this was indeed resolved thank you so much. The issue with mine seems to have come up when I upgraded to OSX El Capitan. I had to change some permissions in order to to get the Bundler installed and working.

On Oct 25, 2015, at 11:50 PM, André Arko notifications@github.com wrote:

@skutondo https://github.com/skutondo this issue is both fixed and closed. If you are having an issue you would like to report, please follow ISSUES https://github.com/bundler/bundler/blob/master/ISSUES.md.


Reply to this email directly or view it on GitHub #2204 (comment).

@JyotsnaGorle
Copy link

@indirect can you please share the link where the issue has been resolved. And how I can go about it. I am facing the same issue.

cannot load such file -- pry (LoadError)
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:128:in require' /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:128:inrescue in require'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:39:in require' /Users/jyotsna/Projects/AIB/piccolo/calabash-features/features/step_definitions/app-settings_steps.rb:1:in<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/rb_support/rb_language.rb:95:in load' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/rb_support/rb_language.rb:95:inload_code_file'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:180:in load_file' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:83:inblock in load_files!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:82:in each' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:82:inload_files!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:184:in load_step_definitions' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:42:inrun!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/lib/cucumber/cli/main.rb:47:in execute!' /Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.20/bin/cucumber:13:in<top (required)>'
/usr/bin/cucumber:23:in load' /usr/bin/cucumber:23:in

'

though I am still on yosemite.

@indirect
Copy link
Member

@JyotsnaGorle this ticket was a problem with Bundler 1.2, and was fixed in Bundler 1.3. That was 3 years ago.

If you are having a problem with Bundler, please follow ISSUES and report your problem in a new ticket.

@mcelio
Copy link

mcelio commented Feb 15, 2016

Hi getleman!

I have the same problem running Ruby platform on Windows. Please, do You have any clue What should I do?:

gem -v
2.4.8
ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x64-mingw32]
bundler -v
1.11.2

@kinjal20
Copy link

bundle install

/usr/share/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- bundler (LoadError) from /usr/share/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/bin/bundle:7:in `

'

what can be solution of it?

@ghost
Copy link

ghost commented Mar 21, 2018

Hi there, anyone got a fix for it? I have the exact same issue. Thanks

@harshrk
Copy link

harshrk commented Jan 26, 2019

Here is how I resolved it (on windows 10). I had first ROR installed using railsinstaller. Then the guide said you should also install Ruby Dev Kit, so installed it. Then when I faced this issue, I just uninstalled Ruby Dev Kit completely and lef just the original Rails installation. This solved the problem for me. So the trick is dont install ruby dev kit and if you installed it remove it. I am a newbie, so I dont know how this help resolved it. But it did.

@senthil7213
Copy link

when I install puppet master thru aws instance on gitbash terminal i am getting below issue
sudo foreman-installer
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- ansi/code (LoadError) from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/lib/ruby/vendor_ruby/kafo/progress_bar.rb:3:in <top (required)>' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/lib/ruby/vendor_ruby/kafo/kafo_configure.rb:21:in <top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/lib/ruby/vendor_ruby/kafo.rb:3:in <top (required)>' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/lib/ruby/2.3.0/rubygems/core_ex

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants