无法加载EventMachine C扩展;要使用纯Ruby反应器 [英] Unable to load the EventMachine C extension; To use the pure-ruby reactor

查看:23
本文介绍了无法加载EventMachine C扩展;要使用纯Ruby反应器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到麻烦了,在一个Rails项目(redmine2.3)中,Rails版本是3.2

启动项目

bundle exec thin start -p 8080 -e production -s 5 -d

错误信息

(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
/var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `require': libruby.so.2.0: cannot open shared object file: No such file or directory - /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/rubyeventmachine.so (LoadError)
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `<top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:7:in `require'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:7:in `<top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/bin/thin:5:in `require'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/bin/thin:5:in `<top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/bin/thin:23:in `load'
    from /var/wtn/vendor/cache/ruby/2.0.0/bin/thin:23:in `<main>'

运行rails -v时出现相同的错误

rails -v
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here

在项目中运行bundle exec .....会产生相同的错误

问题解决了,请看我在三楼的评论,有答案

推荐答案

我在Windows10上尝试使用Jekyll的实时重新加载功能时遇到此错误消息。此处的其他答案没有完全解决问题,或者有可能在下次运行bundle install时再次出现此问题。

我的解决方案(摘自this site)是:

  1. 运行此控制台命令

    gem uninstall eventmachine 
    

    并选择从您的系统中卸载eventmachine-1.2.7-x64-mingw32gem。

  2. 编辑项目目录中的Gemfile并在其中添加以下行:

    gem 'eventmachine', '1.2.7', git: 'https://github.com/eventmachine/eventmachine.git', tag: 'v1.2.7'
    
  3. 运行

    bundle install
    
  4. 使用命令清理Jekyll生成和缓存

    bundle exec jekyll clean
    

您现在可以使用--livereload参数而不会遇到任何问题,即使以后执行bundle install也是如此。

这篇关于无法加载EventMachine C扩展;要使用纯Ruby反应器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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