【问题标题】:uninitialized constant RubyVM::DebugInspector seen in official Rails getting started guide在官方 Rails 入门指南中看到的未初始化常量 RubyVM::DebugInspector
【发布时间】:2026-01-14 15:55:01
【问题描述】:

我是Ruby on Rails的新用户,一直在关注官方的入门。

平台:Windows 10
红宝石 2.2.4
导轨 4.2.5.2

我在做什么:

rails new myapp
cd myapp
捆绑安装
rails server

然后我得到这个错误:

C:\Users\MyUser\AAA\myapp>rails server
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/binding_of_caller-0.7.2/lib/binding_of_caller/mri2.rb:21:in `callers': uninitialized constant RubyVM::DebugInspector (NameError)
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.3.0/lib/web_console/integration/cruby.rb:28:in `set_backtrace_with_binding_of_caller'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
    from C:/Users/MyUser/AAA/myapp/config/application.rb:7:in `<top (required)>'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:78:in `require'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:75:in `server'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5.2/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

我已经尝试卸载debug_inspector并在之后运行bundle install,但问题仍然存在。

谁能帮帮我?

【问题讨论】:

  • 您找到解决方案了吗?

标签: ruby-on-rails ruby server rubygems


【解决方案1】:

如果它仍然是真实的。尝试将 debug_inspector 添加到您的 Gemfile。

【讨论】:

    【解决方案2】:

    您需要在启动 rails 服务器之前捆绑 gem。请按照以下步骤操作:

    rails new myapp
    cd myapp
    bundle install
    rails server
    

    【讨论】: