custom_require.rb在eventmachine安装中加载错误

时间:2013-03-14 09:11:40

标签: ruby rubygems bundler eventmachine

我的gems依赖项存在问题:Gemfile的内容是

source :gemcutter
gem "sinatra"
gem "koala"
gem "json", "1.5.5"
gem "httparty"
gem "thin"
gem "rack", "1.3.10"

一个bundle install发现了这个错误

$ sudo bundle install
The source :gemcutter is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Fetching gem metadata from http://rubygems.org/.......
Fetching gem metadata from http://rubygems.org/..
Using addressable (2.2.7) 
Using crack (0.1.8) 
Using daemons (1.1.3) 
Installing eventmachine (0.12.10) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb 
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:1:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/eventmachine-0.12.10 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.out

An error occurred while installing eventmachine (0.12.10), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '0.12.10'` succeeds before bundling.

但是,执行安装了eventmachine!:

$ gem list

*** LOCAL GEMS ***

eventmachine (1.0.3, 1.0.0.rc.4, 0.12.10)

帮助我,你是我唯一的希望!谢谢。

1 个答案:

答案 0 :(得分:3)

ruby​​ 1.9.1有一些C扩展问题。尝试检查您是否mkmf

locate mkmf

或安装devy版本的ruby 1.9.1:

sudo apt-get install ruby1.9.1-dev

我建议使用RVM安装红宝石:https://rvm.io/

您还可以尝试更改Gemfile中的源

source 'https://rubygems.org'

而不是:gemcutter