【问题标题】:Rails 4.2 web-console issueRails 4.2 Web 控制台问题
【发布时间】:2015-02-20 20:58:01
【问题描述】:

升级到 Rails 4.2 后,我很高兴尝试新集成的 Web 控制台,但我遇到了一些问题。

在 Rails 4.2 的发行说明中,它提到:“使用 Rails 4.2 生成的新应用程序现在默认带有 Web 控制台 gem。”

自从我升级到 4.2,我认为这意味着我仍然需要在我的 Gemfile 中指定它。如果不将它添加到我的 Gemfile 中,rails 只会给我“未定义的局部变量或方法‘控制台’”,所以我认为是这样。

将 gem 'web-console', '~> 2.0' 添加到 Gemfile 并运行 rails 服务器后,我现在得到:

/home/kevin/.rvm/gems/ruby-2.1.5/gems/binding_of_caller-0.7.3.pre1/lib/binding_of_caller/mri2.rb:21:in `callers': uninitialized constant RubyVM::DebugInspector (NameError)
  from /home/kevin/.rvm/gems/ruby-2.1.5/gems/better_errors-2.0.0/lib/better_errors/exception_extension.rb:7:in `set_backtrace'
  from /home/kevin/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in `require'
  from /home/kevin/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
  from /home/kevin/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in `each'
  from /home/kevin/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in `block in require'
  from /home/kevin/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in `each'
  from /home/kevin/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in `require'
  from /home/kevin/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler.rb:133:in `require'
  from /home/kevin/workspace/applications/ems-heroes/config/application.rb:6:in `<top (required)>'
  from /home/kevin/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
  from /home/kevin/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
  from /home/kevin/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
  from /home/kevin/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
  from /home/kevin/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
  from /home/kevin/.rvm/gems/ruby-2.1.5/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
  from bin/rails:4:in `require'
  from bin/rails:4:in `<main>'

我用谷歌搜索并没有找到太多。非常感谢任何建议。

谢谢!

【问题讨论】:

  • 您是否通过捆绑舞来完成升级?你rake rails:update 吗?
  • 还有一个关于 web_console 和 better_errors 的未解决问题现在可以正常工作,但错误与您的不同。
  • 我确实做了捆绑舞,并在那里解决了几个小问题。在你提到它之后,我还逐步了解了 rake rails:update。仍然没有解决这个错误:(
  • 我唯一会尝试的另一件事是删除 better_errors temp,看看是否能修复错误,因为我不确定他们相处得如何......
  • 刚刚试过。没有雪茄 :( 还是谢谢@Doon

标签: ruby-on-rails ruby gem rails-console ruby-on-rails-4.2


【解决方案1】:

原来我的问题来自依赖项“debug_inspector”。

感谢:https://github.com/banister/binding_of_caller/issues/39

我只需要跑:

$ gem uninstall debug_inspector
$ bundle install

【讨论】:

    猜你喜欢
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    • 2021-02-13
    • 1970-01-01
    • 2011-05-28
    • 1970-01-01
    • 1970-01-01
    • 2015-02-22
    相关资源
    最近更新 更多