Getting undefined method `+' for nil:NilClass only with RubyMine debugger on

时间:2023-01-17 12:06:15

My environment:

我的环境:

Ubuntu 14
Ruby 2.2.1
Rails 4.2

Newly created rails application, with 1 action:

新创建的rails应用程序,具有1个操作:

class FramesController < ApplicationController
  def index
    return 0
  end
end

Wherever I put a breakpoint (in presented case at return 0), I get this error in my browser:

无论我在哪里放置一个断点(在返回0的情况下),我在浏览器中收到此错误:

undefined method `+' for nil:NilClass

It only happens when I use the 'Debug' option in RubyMine and when a breakpoint is reached. When I run the server without debugger/breakpoints, everything works fine.

只有当我在RubyMine中使用'Debug'选项并且到达断点时才会发生这种情况。当我在没有调试器/断点的情况下运行服务器时,一切正常。

1 个解决方案

#1


22  

I had the same issue, and just removing the byebug gem from the Gemfile fixed it

我有同样的问题,只是从Gemfile中删除了byebug gem修复它

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  #gem 'byebug'

Check if you have the byebug in the Gemfile and in case disable it.

检查Gemfile中是否有byebug,以防万一。

Tested with Intellij Idea 14.1, should also apply to RubyMine

使用Intellij Idea 14.1进行测试,也应该适用于RubyMine

#1


22  

I had the same issue, and just removing the byebug gem from the Gemfile fixed it

我有同样的问题,只是从Gemfile中删除了byebug gem修复它

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  #gem 'byebug'

Check if you have the byebug in the Gemfile and in case disable it.

检查Gemfile中是否有byebug,以防万一。

Tested with Intellij Idea 14.1, should also apply to RubyMine

使用Intellij Idea 14.1进行测试,也应该适用于RubyMine