无法在Windows上运行rails的'瘦'服务器。无法加载EventMachine C扩展

时间:2018-05-12 23:23:09

标签: ruby-on-rails windows thin

我在这里阅读了一些说明

https://coderwall.com/p/fltw9q/use-thin-as-your-default-server-in-rails-app

gem install thin< - 适合我

我在我的Gemfile

中添加了'thin'

bundle install< - 适合我

(所以这个问题与捆绑安装不起作用的类似问题不同)

然后我尝试了thin sthin start

C:\rubytest\paramstest1>thin s
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require': cannot load such file -- 2.4/rubyeventm
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7-x64-mingw32/lib/rubyeventmachine.rb:2:in `<top (req
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb:8:in `<top (require
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thin-1.7.2/lib/thin.rb:7:in `<top (required)>'
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
        from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thin-1.7.2/bin/thin:5:in `<top (required)>'
        from C:/Ruby24-x64/bin/thin:23:in `load'
        from C:/Ruby24-x64/bin/thin:23:in `<main>'

我注意到另一个问题来自一个无法安装的人,(虽然他是在* nix而不是windows)。 Rails - cannot run app: Unable to load the EventMachine C extension;并且答案建议添加一个可以称为event_machine.rb的rb文件,并给它这个需要行。要求'em / pure_ruby'

C:\rubytest\paramstest1\config\initializers>type event_machine.rb
require 'em/pure_ruby'
C:\rubytest\paramstest1\config\initializers>

似乎没有太多差别,我仍然得到那个错误

C:\rubytest\paramstest1>thin start
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'

答案

Cannot install thin on windows

建议

gem install eventmachine --pre

C:\rubytest\paramstest1>gem install eventmachine --pre
Successfully installed eventmachine-1.2.7-x64-mingw32
Parsing documentation for eventmachine-1.2.7-x64-mingw32
Done installing documentation for eventmachine after 2 seconds
1 gem installed

无论如何,我可能已经有了这个。

我的宝石文件有宝石'瘦',有或没有宝石'eventmachine'

我尝试thin start但得到同样的错误

rails s现在也出现了错误!

0 个答案:

没有答案