安装eventmachine(1.0.3)时出错[重复]

Posted

技术标签:

【中文标题】安装eventmachine(1.0.3)时出错[重复]【英文标题】:An error occurred while installing eventmachine (1.0.3) [duplicate] 【发布时间】:2016-04-04 23:27:26 【问题描述】:

我安装了 Rails 4.2.5 和 ruby​​ 2.0.0。

这是一个项目的 Gemfile:

source 'https://rubygems.org'

gem "whenever"

gem "therubyracer"
gem "less-rails"
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'

gem 'geokit'

gem 'sequenced'

gem 'acts-as-taggable-on'

gem 'bcrypt', :require => 'bcrypt'

gem 'rack-cors', :require => 'rack/cors'

# Paperclip
gem "paperclip", "~> 4.2"

gem "thin"

gem "passenger"

gem 'geocoder'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.6'
# Use sqlite3 as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for javascript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development

当我进行捆绑安装时,我收到以下错误: “安装 eventmachine (1.0.3) 时出错,Bundler 无法继续。请确保 gem install eventmachine -v '1.0.3' 在捆绑之前成功。”

如果我让 gem install eventmachine 我有以下错误

make "DESTDIR=" compiling binder.cpp
In file included from binder.cpp:20:
./project.h:116:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^
1 error generated.
make: *** [binder.o] Error 1
Gem files will remain installed in        /Library/Ruby/Gems/2.0.0/gems/eventmachine-1.0.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/eventmachine-1.0.8/ext/gem_make.out

我该如何解决?

【问题讨论】:

在安装 eventmachine 之前,您必须在您的操作系统上安装 openssl。顺便说一句,根据我的经验,eventmachine 不适用于 rails 4.2。您将不得不降级到 rails 4.1 我已经尝试安装openssl,但没有成功。还有其他建议吗? 如果您使用 El Capitan,则在安装 OpenSSL 时必须使用 sudo。 @pauloancheta 是的,我做到了 试试 brew link openssl --force 【参考方案1】:

我之前遇到过这个问题,运行下面的命令就可以了

gem install eventmachine -v '1.0.3'  -- --with-cppflags=-I/usr/local/opt/openssl/include

我不记得我是在哪里找到它的,也不记得它起作用的原因。也许其他人可以补充答案。

【讨论】:

有类似的问题,但我说-v '1.0.7';用 7 替换了 3,它起作用了!我谢谢:) 谢谢..这个解决方案适用于 1.0.7 谢谢你!它适用于-v 1.0.7 安装 ruby​​-dev 为我解决了这个问题。 对我来说是因为我没有安装g++,我猜ruby-dev也是必要的

以上是关于安装eventmachine(1.0.3)时出错[重复]的主要内容,如果未能解决你的问题,请参考以下文章

安装科尔多瓦时出错

Thin + EventMachine 无法启动

无法在 Rails 控制台中加载 Ruby EventMachine - 没有要加载的文件

Ruby(bundle install,bundle update)FAILS无法安装gems http_parser.rb,eventmachine

如何在 EventMachine 实现中捕获异常?

Rails - 无法运行应用程序:无法加载 EventMachine C 扩展;