Rails webrick 强制退出:未初始化的常量 WebConsole::Railtie::Middleware (NameError)

Posted

技术标签:

【中文标题】Rails webrick 强制退出:未初始化的常量 WebConsole::Railtie::Middleware (NameError)【英文标题】:Rails webrick force-exits: uninitialized constant WebConsole::Railtie::Middleware (NameError) 【发布时间】:2015-06-02 05:44:11 【问题描述】:

所以我是第一次尝试启动 webrick 的 ruby​​ 新手。我最近刚刚用 mysql2 修复了分段错误错误,并遇到了这个新的退出问题。这是命令行读数:

G:\Ruby 开发\simple_cms>

G:\Ruby Development\simple_cms>rails 服务器

=> 启动 WEBrick

=> Rails 4.2.1 应用程序在 http://localhost:3000 开始开发

=> 运行 rails server -h 以获得更多启动选项

=> Ctrl-C 关闭服务器

退出

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.1.2/lib/web_console/railtie.rb:21:in`block in ': 未初始化的常量 WebConsole: :Railtie::Middleware (NameError)

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:345:in `each'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:345:in `call'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'

来自 C:/Ruby22-x64/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'

来自 G:/Ruby Development/simple_cms/config/environment.rb:5:in `'

来自 G:/Ruby Development/simple_cms/config.ru:3:in `require'

来自 G:/Ruby Development/simple_cms/config.ru:3:in `block in'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'

来自 G:/Ruby Development/simple_cms/config.ru:in `new'

来自 G:/Ruby Development/simple_cms/config.ru:in `'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in `app'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:139:in `log_to_stdout'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:78:in `start'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'

来自 C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `'

来自 bin/rails:4:in `require'

来自 bin/rails:4:in `'

据我所知,我至少正在加载服务器。所以这不是分段错误的一部分,对吗?

我的 gemfile 包含 web-console 2.1.2。另外,为了以防万一,我已经运行了“捆绑安装”。对此错误有任何见解吗?让我知道是否需要更多信息。

Rails 版本 -4.2.1 Ruby 版本 - 2.2.1p85

【问题讨论】:

有谁知道我是否应该尝试早期版本的 ruby​​? 【参考方案1】:

有两个 rails 可执行文件。您的 PATH 将您指向错误的路径。输入'which rails':你应该得到“~/bin/rails”,一个railties放在你的主目录中的存根。如果你得到别的东西,重命名那里的 rails 可执行文件,然后重试。

【讨论】:

成功了!谢谢。 Rails 安装在一个驱动器上并试图指向另一个驱动器

以上是关于Rails webrick 强制退出:未初始化的常量 WebConsole::Railtie::Middleware (NameError)的主要内容,如果未能解决你的问题,请参考以下文章

Rails启动Webrick Web服务器

在 Elastic Beanstalk 上部署 Rails 应用程序 - WEBrick 会自动被乘客取代吗?

如何在rails下的webrick中设置access-control-allow-origin?

将未维护的 ActiveRecord 适配器强制转换为 Rails 版本 6

Webrick 的响应速度很慢。如何加快速度?

如何设置 webrick 服务器以使用 ruby​​ 1.9.3?