ruby-on-rails - Ruby 导入项目要求 Puma

标签 ruby-on-rails ruby openssl bundler puma

我刚进入一个新项目,我必须学习 Ruby。我做了一些教程,一切都很顺利。我什至能够为我的新生应用程序创建一个网络服务器。
但是,当我导入项目(使用 GIT)并尝试运行它时,我发现自己无法启动 WEBrick 服务器(使用 rails server)。

这是错误消息:

C:\Projects\BookRosa\bin>rails 服务器
在任何来源中都找不到 puma-2.9.2
运行 bundle install 以安装缺少的 gem。

当我运行 bundle install 时:

C:\Projects\BookRosa\bin>bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies........
Using rake 10.3.2
Using i18n 0.6.11
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.42
Using activesupport 4.0.3
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.3
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.3
Using arbre 1.0.2
Using sass 3.2.19
Using thor 0.19.1
Using bourbon 3.2.3
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using railties 4.0.3
Using coffee-rails 4.0.1
Using formtastic 3.0.0
Using formtastic_i18n 0.1.1
Using has_scope 0.6.0.rc
Using responders 1.1.2
Using inherited_resources 1.5.1
Using jquery-rails 3.1.2
Using jquery-ui-rails 5.0.2
Using kaminari 0.16.1
Using activemodel 4.0.3
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.3
Using bundler 1.10.0.rc
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.11.3
Using sprockets-rails 2.0.1
Using rails 4.0.3
Using polyamorous 1.1.0
Using ransack 1.5.1
Using sass-rails 4.0.4
Using activeadmin 1.0.0.pre from git://github.com/activeadmin/activeadmin.git (a
t master)
Using bcrypt 3.1.9
Using climate_control 0.0.3
Using cocaine 0.5.4
Using orm_adapter 0.5.0
Using warden 1.2.3
Using devise 3.4.1
Using devise-i18n 0.11.2
Using jbuilder 1.5.3
Using json 1.8.1
Using paperclip 4.2.0
with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

C:/Ruby21/bin/ruby.exe extconf.rb
checking for SSL_CTX_new() in -lssl... no
checking for SSL_CTX_new() in -lssleay32... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby21/bin/ruby
        --with-puma_http11-dir
        --without-puma_http11-dir
        --with-puma_http11-include
        --without-puma_http11-include=${puma_http11-dir}/include
        --with-puma_http11-lib
        --without-puma_http11-lib=${puma_http11-dir}/lib
        --with-ssllib
        --without-ssllib
        --with-ssleay32lib
        --without-ssleay32lib

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/puma-2.9.2
 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/pum
a-2.9.2/gem_make.out
An error occurred while installing puma (2.9.2), and Bundler cannot continue.
Make sure that `gem install puma -v '2.9.2'` succeeds before bundling.

我已经尝试了 http 和 https 源,安装 devkit,安装 openssl,错误不会消失。我不一定要用puma,但我也脱不下来。我刚创建的应用程序运行良好,所以我不知道问题出在哪里,因为我是 Ruby 的新手

运行 gem install puma -v '2.9.2' 返回以下内容:

checking for SSL_CTX_new() in -lssl... 
no checking for SSL_CTX_new() in -lssleay32... 
no *** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. 
Check the mkmf.log file for more details. 
You may need configuration options. 
Provided configuration options: ... 
extconf failed, exit code 1

最佳答案

我刚遇到同样的问题。这issue帮我弄明白了。

我首先尝试了 brew install openssl && brew link --force openssl 但我已经安装了它。

我的解决方法是运行:

gem install puma -v '2.9.2' -- --with-opt-dir=/usr/local/opt/openssl

希望这对你也有用。

关于ruby-on-rails - Ruby 导入项目要求 Puma,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30350458/

相关文章:

ruby-on-rails - 有没有办法在带有 Mongoid 的 Rails 项目中默认设置 attr_accessible?

ruby-on-rails - 多个服务器上 Rails 中奇怪的 ActiveRecord 时区行为

ruby-on-rails - bundle 和 bundle 更新有什么区别?

apache - 如何使 mod_ssl 指向不同的 openssl 目录而不是 apache 中的默认目录?

c - C 中的 X509* 证书序列化和反序列化

ruby-on-rails - Rails 3 - 生产环境 - smtp 电子邮件问题

mysql - 在 ruby​​ 脚本上使用事件记录和 mysql

ruby-on-rails - 无法为 Delayed::Backend:ActiveRecord::Job 批量分配 protected 属性:优先级队列、payload_object

ruby-on-rails - 如何定期获取/更新 Rails 中的值?

mysql - mysql_ssl_rsa_setup 从哪里获取 OpenSSL 文件?