创建数据库时出现Rails / Ruby错误:无法加载EventMachine C扩展

时间:2013-01-03 06:26:06

标签: ruby-on-rails ruby rubygems gem eventmachine

更新

在我的gemfile中安装了eventmachine gem:

 eventmachine (1.0.0, 0.12.10)

请帮忙!尝试使用以下内容创建数据库:

Fitzs-MacBook-Pro:twilio_insanity Fitz$ rake db:create'

返回以下错误:

  

无法加载EventMachine C扩展程序;使用纯红宝石   反应堆,要求'em / pure_ruby'耙子中止!无法加载此类文件 -   rubyeventmachine   /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in   require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in ”   /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/thin-1.5.0/lib/thin.rb:7:in   require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/thin-1.5.0/lib/thin.rb:7:in ”   /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in   需要'require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in 阻止(2级)   /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in   需要each' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in 阻止   /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in   each' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in 需要”   /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler.rb:128:in   require' /Users/Fitz/Desktop/twilio_insanity/config/application.rb:7:in'/ Users / Fitz / Desktop / twilio_insanity / Rakefile:5:in   require' /Users/Fitz/Desktop/twilio_insanity/Rakefile:5:in”   /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/bin/ruby_noexec_wrapper:14:in   eval' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/bin/ruby_noexec_wrapper:14:in '(通过使用--trace运行任务查看完整跟踪)

```

7 个答案:

答案 0 :(得分:11)

尝试重新安装gem'eventmachine'

$ gem uninstall eventmachine

然后

$ bundle install  ( in the same folder with your Gemfile) 

或只是

$ gem install eventmachine ( if you are not using the Gemfile) 

请参阅:https://stackoverflow.com/a/15140634/445908

答案 1 :(得分:4)

有人在评论中回答......见下文。

基本上虽然我有单独的Ruby版本,但由于某些宝石只安装在某些版本的ruby上,所以它变得令人困惑。

修复完全卸载了ruby和rails,然后重新安装。修好了!

这有助于:

另一个帖子中的

This comment似乎对你的问题很有希望。你能确保你的Gemfile中有“gem eventmachine”或类似的东西,并且可以成功捆绑吗? - Scott Helm 1月6日6:24

答案 2 :(得分:2)

在将ruby从1.9.3升级到2.4后,我在Windows上遇到了同样的错误。 我尝试了我发现的每一个修复,但最终唯一有帮助的是(不是那么明显,因此很难找到)重新安装新的 Ruby 再次 32位而不是64

我还用

安装了Eventmachine
gem install eventmachine --platform=ruby

强制进行本机编译,因为我总是遇到msgpack问题,可以像这样解决(没有尝试使用默认的x86-mingw32

答案 3 :(得分:1)

I am on windows 10. C:\Ruby25-x64\lib\ruby\gems>bundle install showed Could not locate Gemfile error(though, i am having bundle gem installed and present at \gems location). Following worked for me to resolve Unable to load the EventMachine C extension error:

  1. gem uninstall eventmachine
  2. gem install eventmachine --platform ruby

答案 4 :(得分:0)

试试以下内容:

apt-get install libssl0.9.8

它修复了Ubuntu 12.4上的错误

答案 5 :(得分:0)

如果任何此解决方案无效,请尝试使用适用于OS X的方法从源重新安装eventmachine gem:https://stackoverflow.com/a/20950026/83055

答案 6 :(得分:-2)

确保在Gemfile中捆绑eventmachine

gem "eventmachine"

然后bundle installThis comment似乎与您相关。