deivid-rodriguez / byebug

Debugging in Ruby 2
BSD 2-Clause "Simplified" License
3.34k stars 328 forks source link

cannot load such file -- irb (LoadError) #838

Open AlexanderZagaynov opened 1 year ago

AlexanderZagaynov commented 1 year ago

Problem description

CentOS Stream 9 doesn't install irb gem together with ruby package, which leads to the impossibility to run rails console commands, even if I prefer to use pry with byebug.

Workarounds:

Expected behavior

rails console should open pry console without errors and warnings. Other commands, such as rails generate should work too.

Actual behavior

Without any irb

$ bin/rails generate --help
/usr/share/gems/gems/byebug-11.1.3/lib/byebug/commands/irb.rb:4:in `require': cannot load such file -- irb (LoadError)
Did you mean?  erb
               drb
        from /usr/share/gems/gems/byebug-11.1.3/lib/byebug/commands/irb.rb:4:in `<top (required)>'
        from /usr/share/gems/gems/byebug-11.1.3/lib/byebug/commands.rb:20:in `require_relative'
        from /usr/share/gems/gems/byebug-11.1.3/lib/byebug/commands.rb:20:in `<top (required)>'
        from /usr/share/gems/gems/byebug-11.1.3/lib/byebug/core.rb:10:in `require_relative'
        from /usr/share/gems/gems/byebug-11.1.3/lib/byebug/core.rb:10:in `<top (required)>'
        from /usr/share/gems/gems/pry-byebug-3.10.1/lib/byebug/processors/pry_processor.rb:3:in `require'
        from /usr/share/gems/gems/pry-byebug-3.10.1/lib/byebug/processors/pry_processor.rb:3:in `<top (required)>'
        from /usr/share/gems/gems/pry-byebug-3.10.1/lib/pry-byebug/pry_ext.rb:3:in `require'
        from /usr/share/gems/gems/pry-byebug-3.10.1/lib/pry-byebug/pry_ext.rb:3:in `<top (required)>'
        from /usr/share/gems/gems/pry-byebug-3.10.1/lib/pry-byebug/cli.rb:4:in `require'
        from /usr/share/gems/gems/pry-byebug-3.10.1/lib/pry-byebug/cli.rb:4:in `<top (required)>'
        from /usr/share/gems/gems/pry-byebug-3.10.1/lib/pry-byebug.rb:4:in `require'
        from /usr/share/gems/gems/pry-byebug-3.10.1/lib/pry-byebug.rb:4:in `<top (required)>'
        from /usr/local/share/ruby/site_ruby/bundler/runtime.rb:60:in `require'
        from /usr/local/share/ruby/site_ruby/bundler/runtime.rb:60:in `block (2 levels) in require'
        from /usr/local/share/ruby/site_ruby/bundler/runtime.rb:55:in `each'
        from /usr/local/share/ruby/site_ruby/bundler/runtime.rb:55:in `block in require'
        from /usr/local/share/ruby/site_ruby/bundler/runtime.rb:44:in `each'
        from /usr/local/share/ruby/site_ruby/bundler/runtime.rb:44:in `require'
        from /usr/local/share/ruby/site_ruby/bundler.rb:186:in `require'
        from /home/zalex/work/junkyard_app/config/application.rb:19:in `<top (required)>'
        from /usr/share/gems/gems/railties-7.0.4/lib/rails/command/actions.rb:22:in `require'
        from /usr/share/gems/gems/railties-7.0.4/lib/rails/command/actions.rb:22:in `require_application!'
        from /usr/share/gems/gems/railties-7.0.4/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
        from /usr/share/gems/gems/railties-7.0.4/lib/rails/commands/generate/generate_command.rb:10:in `help'
        from /usr/share/gems/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        from /usr/share/gems/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/share/gems/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from /usr/share/gems/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
        from /usr/share/gems/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
        from /usr/share/gems/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

With rubygem-irb-1.3.5-160.el9.noarch system package installed:

$ bin/rails console
/usr/share/ruby/irb/ruby-lex.rb:123: warning: already initialized constant RubyLex::ERROR_TOKENS
/usr/share/gems/gems/irb-1.3.5/lib/irb/ruby-lex.rb:123: warning: previous definition of ERROR_TOKENS was here
/usr/share/ruby/irb/completion.rb:18: warning: already initialized constant IRB::InputCompletor::ReservedWords
/usr/share/gems/gems/irb-1.3.5/lib/irb/completion.rb:18: warning: previous definition of ReservedWords was here
/usr/share/ruby/irb/completion.rb:39: warning: already initialized constant IRB::InputCompletor::BASIC_WORD_BREAK_CHARACTERS
/usr/share/gems/gems/irb-1.3.5/lib/irb/completion.rb:39: warning: previous definition of BASIC_WORD_BREAK_CHARACTERS was here
/usr/share/ruby/irb/completion.rb:59: warning: already initialized constant IRB::InputCompletor::CompletionRequireProc
/usr/share/gems/gems/irb-1.3.5/lib/irb/completion.rb:59: warning: previous definition of CompletionRequireProc was here
/usr/share/ruby/irb/completion.rb:94: warning: already initialized constant IRB::InputCompletor::CompletionProc
/usr/share/gems/gems/irb-1.3.5/lib/irb/completion.rb:94: warning: previous definition of CompletionProc was here
/usr/share/ruby/irb/completion.rb:329: warning: already initialized constant IRB::InputCompletor::PerfectMatchedProc
/usr/share/gems/gems/irb-1.3.5/lib/irb/completion.rb:329: warning: previous definition of PerfectMatchedProc was here
/usr/share/ruby/irb/completion.rb:364: warning: already initialized constant IRB::InputCompletor::Operators
/usr/share/gems/gems/irb-1.3.5/lib/irb/completion.rb:364: warning: previous definition of Operators was here
Loading development environment (Rails 7.0.4)
[1] pry(main)>

Steps to reproduce the problem

More details (bundle env & cat /etc/os-release) here: https://gist.github.com/AlexanderZagaynov/39b71c0e25e4a59b0fe23b6a2425fbf3