当我在 Ruby On Rails 中启动服务器时,它会在启动后立即退出,有时甚至不启动,只会出现错误 [英] When I start the server in Ruby On Rails it exits as soon as it starts and sometimes doesn't even start, just gives an error

查看:77
本文介绍了当我在 Ruby On Rails 中启动服务器时,它会在启动后立即退出,有时甚至不启动,只会出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 Windows 中的错误消息:

This is the error message in Windows:

   C:\Users\USER\Sites\new_cms>rails s
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogir
.rb:29:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw3
/lib/nokogiri.rb:29:in `rescue in <top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw3
/lib/nokogiri.rb:25:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.1/lib/loofah.rb:
:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.1/lib/loofah.rb:
:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/
ib/rails-html-sanitizer.rb:2:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/
ib/rails-html-sanitizer.rb:2:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/sanitize_helper.rb:3:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/sanitize_helper.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/text_helper.rb:32:in `<module:TextHelper>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/text_helper.rb:29:in `<module:Helpers>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/text_helper.rb:6:in `<module:ActionView>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/text_helper.rb:4:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/form_tag_helper.rb:18:in `<module:FormTagHelper>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/form_tag_helper.rb:14:in `<module:Helpers>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/form_tag_helper.rb:8:in `<module:ActionView>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/form_tag_helper.rb:6:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/form_helper.rb:4:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers/form_helper.rb:4:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers.rb:50:in `<module:Helpers>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers.rb:4:in `<module:ActionView>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.0/lib/action
view/helpers.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/legacy_asset_tag_helper.rb:7:in `<module:LegacyAssetTagHelper>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/legacy_asset_tag_helper.rb:6:in `<module:Rails>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/legacy_asset_tag_helper.rb:4:in `<module:Sprockets>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/legacy_asset_tag_helper.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/helper.rb:45:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/helper.rb:45:in `<module:Helper>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/helper.rb:7:in `<module:Rails>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/helper.rb:6:in `<module:Sprockets>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/rails/helper.rb:5:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/railtie.rb:6:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sprockets-rails-2.2.4/lib/s
rockets/railtie.rb:6:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass/r
ils/railtie.rb:2:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass/r
ils/railtie.rb:2:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass/r
ils.rb:11:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass/r
ils.rb:11:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass-r
ils.rb:1:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sass-rails-5.0.1/lib/sass-r
ils.rb:1:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/r
ntime.rb:76:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/r
ntime.rb:76:in `block (2 levels) in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/r
ntime.rb:72:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/r
ntime.rb:72:in `block in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/r
ntime.rb:61:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler/r
ntime.rb:61:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.8.5/lib/bundler.r
:134:in `require'
        from C:/Users/USER/Sites/new_cms/config/application.rb:7:in `<top (requ
red)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/co
mands/commands_tasks.rb:78:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/co
mands/commands_tasks.rb:78:in `block in server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/co
mands/commands_tasks.rb:75:in `tap'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/co
mands/commands_tasks.rb:75:in `server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/co
mands/commands_tasks.rb:39:in `run_command!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/co
mands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

C:\Users\USER\Sites\new_cms>

推荐答案

Nokogiri 没有 Ruby 2.2.1 的二进制文件可用于 mingw32 平台 由于 交叉编译 Ruby 2.2.1 用于 rake-compiler-dev-box.

Nokogiri doesn't have binaries for Ruby 2.2.1 available for the mingw32 platform due to some problems with cross compiling Ruby 2.2.1 for the rake-compiler-dev-box.

由于 Nokogiri 不能在 Windows 上本地编译,唯一的解决方法是 降级到 Ruby 2.1.5.一旦 Ruby 2.2 的下一个补丁级别发布,希望问题会得到解决.

Since Nokogiri doesn't natively compile on Windows, the only fix is to downgrade to Ruby 2.1.5. Once the next patch level of Ruby 2.2 is released hopefully the problem will be solved.

这篇关于当我在 Ruby On Rails 中启动服务器时,它会在启动后立即退出,有时甚至不启动,只会出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆