(未定义的局部变量或方法“byebug”

时间:2022-03-05 23:48:49

I have the follwing error:

我有以下错误:

NameError (undefined local variable or method `byebug'

NameError(未定义的局部变量或方法“byebug”)

Code is

代码是

def  test
  t = ""
  byebug
end

--

- - -

RAILS_ENV=development gem list | grep bye

开发宝石清单再见

byebug (3.5.1)

byebug(3.5.1)

then I run :

然后我跑:

RAILS_ENV=development rails s

RAILS_ENV =发展轨道

but it shows:

但是它显示:

NameError (undefined local variable or method `byebug'

NameError(未定义的局部变量或方法“byebug”)

Do you have any idea why?

你知道为什么吗?

Thanks!

谢谢!

2 个解决方案

#1


22  

It seems you need to

看来你需要这么做

require 'byebug'

需要“byebug”

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

我也遇到了同样的情况,并要求失败,因为“无法加载此类文件”错误,但是向Gemfile中添加的操作是有效的。

#2


0  

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

确保您没有安装附带bundle install的gems——没有开发选项。

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

如果是这样,那就运行bundle install——并进行开发

#1


22  

It seems you need to

看来你需要这么做

require 'byebug'

需要“byebug”

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

我也遇到了同样的情况,并要求失败,因为“无法加载此类文件”错误,但是向Gemfile中添加的操作是有效的。

#2


0  

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

确保您没有安装附带bundle install的gems——没有开发选项。

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

如果是这样,那就运行bundle install——并进行开发