开发者

Ruby Debugger in RubyMine

I am trying to run the debugger in Rubymine and I keep getting this error.

/Users/skline/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/bin/rdebug-ide --port 49877 -- /Users/skline/Sites/2t2/app/mailers/user_notifications.rb
Fast Debugger (ruby-debug-ide 0.4.17.beta3, ruby-debug-base 0.11.26) listens on 127.0.0.1:49877
    <internal:lib/rubygems/custom_require>:29:in `require'
    <internal:lib/rubygems/custom_require>:29:in `require'
    /Users/skline/Sites/2t2/app/mailers/user_notifications.rb:1:in `<top (required)>'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/lib/ruby-debug-ide.rb:112:in `debug_load'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/lib/ruby-debug-ide.rb:112:in `debug_program'
    /Users/skline/.rvm/gems/ruby-1.9.2-p136/gems/ruby-debug-ide-0.4.17.beta3/bin/rdebug-ide:87:in `<top (required)>'
    -e:1:in `load'
    -e:1:in 开发者_运维技巧`<main>'
Uncaught exception: no such file to load -- safe_mailer

Process finished with exit code 0

Any thoughts?


It looks like a gem or other dependency changed in your app. The error you're reporting seems to have the answer embedded in it: check your /app/mailers/user_notifications.rb and see what requirement line 1 is calling for. Then look at lib/rubygems/custom_require at line 29. One of those two files appears to be asking for something that it can't find. I've no experience with the gem you are using, but it seems you may have missed a gem dependency, have a Gem version error, or an Include statement for something that no longer exists or has moved/changed names.


Problem

I got a similar error when using Run > Debug using RubyMine 2016.2.4.

/Users/Mp/.rvm/rubies/ruby-2.3.0/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/Mp/.rvm/gems/ruby-2.3.0@global/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 54743 --host 0.0.0.0 --dispatcher-port 54744 -- /Users/Mp/code/apps/ruby_test/team_system/team.rb
Fast Debugger (ruby-debug-ide 0.6.0, debase 0.2.1, file filtering is supported) listens on 0.0.0.0:54743

Process finished with exit code 0

Initially when I set a breakpoint in a sample ruby file team.rb and ran Run > Debug it worked (console it displayed 0> instead of Process finished with exit code 0)

class Team attr_reader :size def initialize(size) @size = size end end team = Team.new(100)

I spent hours trying to resolve it without success, following posts on the internet. I was ready to reinstall RubyMine, and I decided to contact their support email. I told I had tried everything, such as:

  • Restarting my computer
  • Restarting RubyMine and running rm -rf .idea
  • Running gem pristine --all
  • Trying with ruby 2.1.2 instead of 2.3.0 (i.e. rvm install 2.1.2 rvm list rvm use 2.1.2)
  • Checking my RVM version rvm -v rvm 1.26.11
  • Checking the location of gems with gem env and which ruby. This indicated they are in both in /usr/bin/ruby and /Users/Ls/.rvm/rubies/ruby-2.3.0/bin/ruby
  • Uninstalling (i.e. gem uninstall ...) relevant gems in both the global Ruby location and default RVM
  • Reinstalling them again $ gem install debug_inspector $ gem install debugger-linecache $ gem install ruby-debug-ide $ gem install debase $ gem install debase-ruby_core_source $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debug_inspector $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debug-linecache $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global ruby-debug-ide $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debase $ gem install -i /Users/Ls/.rvm/gems/ruby-2.3.0@global debase-ruby_core_source $ gem install linecache19-0.5.13.gem
  • Running bundle update
  • Updating to RubyMine 2016.2.4
  • Going to File > Default Settings > Languages & Frameworks > Ruby SDK and Gems > and selecting to use RVM: ruby-2.3.0
  • Going to Run > Edit Configurations for current ruby file, and in Configuration tab clicking "Use Other SDK" and choosing RVM: ruby-2.3.0 [global] (I have also tried choosing just RVM: ruby-2.3.0)

Solution

I got feedback from RubyMine Support suggesting that I show them the output of gem list and to turn on Verbose Output (Settings > Build, Execution, Deployment > Debugger > Verbose debugger).

Instead of responding immediately their feedback gave me a strong clue it must be caused by a gem conflict, so I tried the following approach, which got it to work again!

  • Cleared RubyMine Cache File > Invalidate Caches & Restart > Invalidate Caches & Restart
  • Showed Ruby gems stored globally, in RVM 2.3.0 (global), and in RVM 2.3.0 (default). Note: I have filtered the list shown below to only display the relevant ones

$ GEM_PATH=$GEM_HOME gem list LOCAL GEMS debase (0.2.1) debase-ruby_core_source (0.9.2) debug_inspector (0.0.2) debugger-linecache (1.2.0) linecache19 (0.5.13) ruby-debug-ide (0.6.1.beta2, 0.6.0) ruby_core_source (0.1.5)

$ rvm ruby-2.3.0 do gem list LOCAL GEMS debase (0.2.1) debase-ruby_core_source (0.9.2) debug_inspector (0.0.2) debugger-linecache (1.2.0) linecache19 (0.5.13) ruby-debug-ide (0.6.1.beta2, 0.6.0) ruby_core_source (0.1.5)

$ rvm ruby-2.3.0 @global do gem list LOCAL GEMS debase (0.2.1) debase-ruby_core_source (0.9.2) debug_inspector (0.0.2) linecache19 (0.5.13) ruby-debug-ide (0.6.0)

  • Installed latest version of Ruby $ rvm install ruby-2.3.1
  • Showed Ruby gems in RVM 2.3.1 (global) and RVM 2.3.1 (default). Both with same result

$ rvm ruby-2.3.1 do gem list $ rvm ruby-2.3.1 @global do gem list LOCAL GEMS bigdecimal (1.2.8) did_you_mean (1.0.0) gem-wrappers (1.2.7) io-console (0.4.5) json (1.8.3) minitest (5.8.3) net-telnet (0.1.1) power_assert (0.2.6) psych (2.0.17) rake (10.4.2) rdoc (4.2.1) rvm (1.11.3.9) test-unit (3.1.5)

  • Checked current version of RVM and upgraded from 1.26.11 to latest version 1.27.0 $ rvm -v $ rvm get stable $ rvm reload $ rvm list
  • Created a Gemset specifically for housing gems to test functionality using RubyMine https://rvm.io/gemsets/basics rvm ruby-2.3.1 do rvm gemset create rubymine_2016_4_2
  • Checked Ruby version had changed $ ruby -v ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
  • Opened RubyMine 2016_2_4 and went to File > Default Settings > Languages & Frameworks > Ruby SDK and Gems. I unselected RVM: ruby-2.3.0, and then instead selected RVM: ruby-2.3.1 rubymine_2016_2_4. I then clicked the 'green tick' icon to use it for the project, and finally clicked OK
  • With the team.rb file that I wanted to debug opened, I then opened Run > Edit Configurations. I then selected Other SDK: RVM: ruby-2.3.1 [rubymine_2016_2_4], and finally clicked OK. This caused a popup window to appear stating: "the gem debase required by the debugger is not currently installed. Would you like to install it?". I clicked Yes
  • Checked to see how RubyMine had changed my custom rubymine_2016_2_4 gemset

$ rvm ruby-2.3.1@rubymine_2016_2_4 do gem list LOCAL GEMS bigdecimal (1.2.8) debase (0.2.2.beta8, 0.2.1) debase-ruby_core_source (0.9.2) did_you_mean (1.0.0) gem-wrappers (1.2.7) io-console (0.4.5) json (1.8.3) minitest (5.8.3) net-telnet (0.1.1) power_assert (0.2.6) psych (2.0.17) rake (10.4.2) rdoc (4.2.1) ruby-debug-ide (0.6.1.beta2) rvm (1.11.3.9) test-unit (3.1.5)

  • Tried debugging again by setting a breakpoint in the sample ruby file team.rb and ran Run > Debug. It worked and console it displayed 0> instead of Process finished with exit code 0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜