无法使用Ruby 1.9.3在RubyMine 4.5中进行调试怎么办?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (159)

所以,我正在努力使用Ruby 1.9.3来调试RubyMine 4.5,我的步骤如下:

新(即删除了所有以前的ruby和gem目录)安装Ruby 1.9.3,Ruby Gems,DevKit和Rails——工作正常。

然后我尝试着开始使用我团队的ruby代码。我在RubyMine中打开目录(首先删除.idea目录),并提示按要求运行bundle install我从控制台运行的目录。这成功完成。重新启动RubyMine。

然后我确保Ruby正在工作:工具> IRB控制台> puts "test" #test => nil- 工程我现在尝试调试器(SHIFT+ F9)并查看消息:

The gem ruby-debug-base19x required by the debugger is currently not installed. Would you like to install it?"

我点击取消并检查我的Gemfile,唯一与调试相关的是:

# Debugging
gem 'debugger'
#gem 'ruby-debug-base19', :require => false
#gem 'ruby-debug19', :require => false
gem 'ruby-prof', :require => false #, :git => 'git://github.com/wycats/ruby-prof.git'

我从Gemfile注释掉调试器并运行

gem install ruby-debug-base19x --pre
gem install ruby-debug-ide --pre

补充

gem 'ruby-debug-base19x', '0.11.30.pre10'
gem 'ruby-debug-ide', '0.4.17.beta14'

到我的Gemfile,并bundle install从控制台运行一个。

最后,我在RubyMine(SHIFT + F9)中打开调试器。并puts "test" #test => nil再次运作。所以我尝试双击我的脚本的阴沟来创建一个断点,RubyMine暂停一秒钟,然后我得到:

D:\Ruby\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/bin/rdebug-ide --dispatcher-port 55451 --port 55452 -- S:/code/account_groups/script/rails console
Fast Debugger (ruby-debug-ide 0.4.17.beta14, ruby-debug-base 0.11.30.pre10) listens on 127.0.0.1:55452
D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby_debug.so: warning: already initialized constant VERSION
5992: Exception in DebugThread loop: undefined method `errmsg' for #<Debugger::ControlState:0x2a2f3e8>
Backtrace:
D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby-debug/command.rb:160:in `errmsg'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby-debug/commands/breakpoints.rb:81:in `execute'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:89:in `block in process_commands'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:86:in `catch'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:86:in `process_commands'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide.rb:160:in `block in start_control'

Process finished with exit code 0

我也尝试使用代码的备份副本,并遵循相同的步骤,当尝试加载调试器时,我也遇到以下错误:

Uncaught exception: cannot load such file -- ruby-debug
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    S:/code/account_groups_so/lib/systematic-online/r_spec_runner.rb:5:in `<top (required)>'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    S:/code/account_groups_so/config/environment.rb:12:in `block in <top (required)>'
    S:/code/account_groups_so/config/environment.rb:12:in `each'
    S:/code/account_groups_so/config/environment.rb:12:in `<top (required)>'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:103:in `require_environment!'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:40:in `<top (required)>'
    S:/code/account_groups_so/script/rails:6:in `require'
    S:/code/account_groups_so/script/rails:6:in `<top (required)>'

脚本没有错(之前我用过它),跟踪似乎与ruby-debug-ide- 发生了什么?

提问于
用户回答回答于

更新Rubymine 6+支持调试器GEM。

确保移除gem 'debugger'从你的Gemfile,这是一个已知的冲突,它将中断Rubymy的调试。只需要两个调试器。

移除GEM之后,需要确保它在项目中的任何地方都没有被引用。在这种情况下r_spec_runner.rbrequire 'ruby-debug'语句引起cannot load such file -- ruby-debug试图运行时出错rails console...

用户回答回答于

为了逃避这个问题,我在我的Gemfile:

gem 'debugger' unless ENV["RM_INFO"]

扫码关注云+社区