简体   繁体   English

无法在Ruby on Rails上安装Puma gem

[英]Cannot install Puma gem on Ruby on Rails

I'm trying to install the puma gem, but when I run 我正在尝试安装美洲狮宝石,但是当我跑的时候

gem install puma

I get this error message: 我收到此错误消息:

Temporarily enhancing PATH to include DevKit
Building native extensions.  This could take a while...
ERROR:  Error installing puma:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile

make                                                
generating puma_http11-i386-mingw32.def                              
compiling http11_parser.c       
ext/http11/http11_parser.rl: In function 'puma_parser_execute':  
ext/http11/http11_parser.rl:111:3: warning: comparison between signed and unsigned integer   expressions    
compiling io_buffer.c   
io_buffer.c: In function 'buf_to_str':             
io_buffer.c:119:3: warning: pointer targets in passing argument 1 of 'rb_str_new'      differ in signedness             
c:/Ruby193/include/ruby-1.9.1/ruby/intern.h:653:7: note: expected 'const char *' but argument is of type 'uint8_t *'                    
compiling mini_ssl.c                                         
In file included from mini_ssl.c:3:0:                                        
c:/Ruby193/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"              
mini_ssl.c:4:25: fatal error: openssl/bio.h: No such file or directory               
compilation terminated.                     
make: *** [mini_ssl.o] Error 1             

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0/ext/puma_http11/gem_make.out

Adding gem 'puma' to my Gemfile and running bundle install isn't an option, because that just doesn't work with any gem and gives me an error message (which is a separate issue, one that I've circumvented with the other gems I've used by installing them via gem install ). gem 'puma'添加到我的Gemfile并运行bundle install不是一个选项,因为它不适用于任何gem并给我一个错误消息(这是一个单独的问题,我已经绕过另一个问题)我通过gem install安装它们使用的gem install )。

Came across very same issue. 遇到了同样的问题。

sudo apt-get install libssl-dev

fixed it for me. 为我修好了。

I ran bundle update before bundle install and that solved the issue for me. 我在bundle install之前运行了bundle update ,这解决了我的问题。

I'm not sure if that was the only thing that helped, as I manually updated puma before that, using these steps: 我不确定这是否是唯一有帮助的东西,因为我在此之前手动更新了puma,使用以下步骤:

  1. Checked which version of openssl Ruby is using by running ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION" 通过运行ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"检查openssl Ruby正在使用哪个版本ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"
  2. Downloaded the right openssl version from http://packages.openknapsack.org/openssl/openssl-1.0.0o-x86-windows.tar.lzma (got the link from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows and edited it based on the output of #1). http://packages.openknapsack.org/openssl/openssl-1.0.0o-x86-windows.tar.lzma下载了正确的openssl版本(从https://github.com/hicknhack-software/rails-获取链接disco / wiki /安装-puma-on-windows并根据#1的输出进行编辑。
  3. Extracted openssl using http://www.7-zip.org to C:\\RailsInstaller\\openssl 使用http://www.7-zip.org将C语言提取到C:\\ RailsInstaller \\ openssl
  4. gem install puma -- --with-opt-dir=C:/RailsInstaller/openssl

Figured out the solution to the puma bundle. 想出了美洲狮捆绑的解决方案。 Followed directions from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows 以下来自https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows的指示

First you need to download: 首先你需要下载:

  • DevKit compatible with your ruby version DevKit与您的ruby版本兼容
  • OpenSSL Developer Package (contains header files and binaries) OpenSSL开发包(包含头文件和二进制文件)

And then: 接着:

  • Install DevKit, eg in c:\\devkit 安装DevKit,例如在c:\\devkit
  • Unpack the OpenSSL Package, eg in c:\\openssl (use 7Zip or PeaZip) 解压缩OpenSSL包,例如在c:\\openssl (使用7Zip或PeaZip)
  • You need to copy the ddls from the bin directory ( libeay32.dll and ssleay32.dll ) to your ruby/bin directory. 您需要将bin目录( libeay32.dllssleay32.dll )中的ddls复制到ruby / bin目录。
  • Open a windows console 打开Windows控制台
  • Initialize the DevKit build environment: c:\\devkit\\devkitvars.bat (except here, I used this in command prompt instead: ruby dk.rb init ) 初始化DevKit构建环境: c:\\devkit\\devkitvars.bat (除了这里,我在命令提示符中使用了这个: ruby dk.rb init

Now it's possible to install the puma gem with the OpenSSL packages: 现在可以使用OpenSSL包安装puma gem:

gem install puma -- --with-opt-dir=c:\openssl

I think you hit issue #430 https://github.com/puma/puma/issues/430 我认为你遇到问题#430 https://github.com/puma/puma/issues/430

Re-installing Ruby might help you as well as it closed this issue on GitHub. 重新安装Ruby可能会帮助你,也可以在GitHub上关闭这个问题。

I am using Windows 8 and couldn't get this work in development mode. 我使用的是Windows 8,无法在开发模式下完成这项工作。 Surely, it worked on production mode when I deployed to Heroku. 当然,当我部署到Heroku时,它在生产模式下工作。 Have you tried in production mode? 你有没有尝试过生产模式?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM