(undefined local variable or method `byebug'

断了今生、忘了曾经 提交于 2019-12-05 12:43:15

问题


I have the follwing error:

NameError (undefined local variable or method `byebug'

Code is

def  test
  t = ""
  byebug
end

--

RAILS_ENV=development gem list | grep bye

byebug (3.5.1)

then I run :

RAILS_ENV=development rails s

but it shows:

NameError (undefined local variable or method `byebug'

Do you have any idea why?

Thanks!


回答1:


It seems you need to

require 'byebug'

I was in the same situation and require failed with 'cannot load such file' error but adding to the Gemfile worked.




回答2:


Make sure you haven't installed the gems with bundle install --without development option.

If that is the case just run bundle install --with development



来源:https://stackoverflow.com/questions/26391867/undefined-local-variable-or-method-byebug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!