【问题标题】:byebug and ruby 2.2.3byebug 和红宝石 2.2.3
【发布时间】:2015-11-26 19:41:40
【问题描述】:

第一次尝试在 ruby​​ 2.2.3 中使用 byebug 时,我得到了

NameError:
      undefined local variable or method `byebug'

我很困惑,这里有一些诊断:

ruby --version
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]

cat Gemfile | grep bye
gem 'byebug'

gem list | grep bye
byebug (8.2.1, 8.2.0)

#the command I'm using to run my ruby code is
rspec *spec.rb --tag focus
#also tried prepending bundle exec

【问题讨论】:

  • 为了方便调试,我的 rspec_helper 中有一个 require 'byebug'。

标签: ruby rubygems pry byebug


【解决方案1】:

想办法。我需要这条线:

require 'byebug'; byebug;

在我的 ruby​​ 代码中。

【讨论】:

    【解决方案2】:

    您是否在您的应用程序上运行了bundle install(假设这是在您使用 Gemfiles 的 Rails 应用程序的上下文中)?

    编辑:你想通了,我明白了 :D 我打算建议接下来需要该库,但我发现我不需要。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-09
      • 1970-01-01
      相关资源
      最近更新 更多