2

直到今天,我才能毫无问题地调试我的代码。我不知道我改变了什么可能会影响这个但现在我的

require "ruby-debug" 

当我尝试运行某个功能时,在我的 env.rb 中导致以下问题...

    cannot load such file -- irb/init (LoadError)
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
    /usr/lib/ruby/1.9.1/irb.rb:13:in `<top (required)>'
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/irb.rb:1:in `<top (required)>'
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:51:in `block in load_commands'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:50:in `each'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:50:in `load_commands'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:210:in `<module:Debugger>'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:5:in `<top (required)>'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:2:in `require_relative'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:2:in `<top (required)>'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:6:in `require_relative'
    /usr/lib/ruby/gems/1.9.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:6:in `<top (required)>'
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require'
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
    /usr/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
    /cygdrive/c/zap2it.com_acceptance_tests/features/support/env.rb:10:in `<top (required)>'
    /usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/rb_support/rb_language.rb:137:in `load'
    /usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/rb_support/rb_language.rb:137:in `load_code_file'
    /usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/runtime/support_code.rb:180:in `load_file'

/usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/runtime/support_code.rb:82:in `each'
/usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/runtime.rb:182:in `load_step_definitions'
/usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/runtime.rb:41:in `run!'
/usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/cli/main.rb:43:in `execute!'
/usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/lib/cucumber/cli/main.rb:20:in `execute'
/usr/lib/ruby/gems/1.9.1/gems/cucumber-1.2.3/bin/cucumber:14:in `<top (required)>'
/usr/bin/cucumber:23:in `load'
/usr/bin/cucumber:23:in `<main>'

如果我删除它一切运行正常,但我仍然没有调试功能。

关于可能导致这种情况的任何想法?

几周后,我仍然遇到这个问题,我尝试卸载-重新安装我所有的 gem,并尝试了 ruby​​-debug19、ruby-debug-base19 和调试器。我试过在我的 env 文件中要求“调试器”或“ruby-debug”,但仍然是同样的错误。难道是我错过了另一个需要的图书馆?

这是 GemFile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    archive-tar-minitar (0.5.2)
    builder (3.2.0)
    capybara (2.1.0)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    childprocess (0.3.9)
      ffi (~> 1.0, >= 1.0.11)
    columnize (0.3.6)
    commonwatir (4.0.0)
    cucumber (1.2.3)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.11.6)
      multi_json (~> 1.3)
    diff-lcs (1.2.1)
    ffi (1.5.0)
    gherkin (2.11.6)
      json (>= 1.7.6)
    httpclient (2.3.2)
    json (1.7.7)
    linecache19 (0.5.12)
      ruby_core_source (>= 0.1.4)
    mime-types (1.23)
    multi_json (1.7.1)
    nokogiri (1.5.9)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rake (10.0.3)
    rspec (2.13.0)
      rspec-core (~> 2.13.0)
      rspec-expectations (~> 2.13.0)
      rspec-mocks (~> 2.13.0)
    rspec-core (2.13.1)
    rspec-expectations (2.13.0)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-mocks (2.13.0)
    ruby-debug-base19 (0.11.25)
      columnize (>= 0.3.1)
      linecache19 (>= 0.5.11)
      ruby_core_source (>= 0.1.4)
    ruby-debug19 (0.11.6)
      columnize (>= 0.3.1)
      linecache19 (>= 0.5.11)
      ruby-debug-base19 (>= 0.11.19)
    ruby_core_source (0.1.5)
      archive-tar-minitar (>= 0.5.2)
    rubyzip (0.9.9)
    selenium-webdriver (2.31.0)
      childprocess (>= 0.2.5)
      multi_json (~> 1.0)
      rubyzip
      websocket (~> 1.0.4)
    watir (4.0.2)
      commonwatir (~> 4)
      watir-webdriver
    watir-webdriver (0.6.2)
      selenium-webdriver (>= 2.18.0)
    websocket (1.0.7)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  capybara
  cucumber
  httpclient
  nokogiri
  rake
  rspec
  ruby-debug19
  selenium-webdriver
  watir
  watir-webdriver

和 GemFile:

source 'https://rubygems.org'

gem 'rake'
gem 'nokogiri'
gem 'httpclient'

group :test do
  gem 'rspec'
  gem 'cucumber'
  gem 'watir'
  gem 'watir-webdriver'
  gem 'selenium-webdriver'
  gem 'capybara'
end
4

2 回答 2

1

你最近更新了 rails 或 ruby​​ 吗?

我不记得哪个版本更新会导致问题,但我认为错误消息看起来像是我在更新后得到的。之后不再支持 ruby​​-debug。

经过一番挖掘,我发现了以下宝石作为替代品:

gem 'ruby-debug-base19x'
gem 'ruby-debug19'

然而这些已经过时了,所以也许看看调试器gem

于 2013-06-11T16:24:13.213 回答
0

此问题的解决方案是在此处删除并安装或

sudo apt-get install libreadline-dev

rvm remove 1.9.3

rvm install 1.9.3

Then add to your Gemfile:

gem 'rb-readline

就像这里

于 2013-07-24T06:21:30.600 回答