无法在Ruby on Rails上安装Puma gem

时间:2022-07-23 09:00:27

I'm trying to install the puma gem, but when I run

我正在安装puma gem,但是当我运行时

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).

在Gemfile中添加gem 'puma'并运行bundle安装不是一个选项,因为这与任何gem都不兼容,并且会给我一个错误消息(这是一个单独的问题,我通过gem安装使用的其他gem绕过了这个问题)。

5 个解决方案

#1


12  

Came across very same issue.

遇到了同样的问题。

sudo apt-get install libssl-dev

fixed it for me.

给我固定它。

#2


9  

I ran bundle update before bundle install and that solved the issue for me.

我在bundle安装之前运行了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"
  2. 通过运行Ruby -v -ropenssl -e“put openssl::OPENSSL_VERSION”检查使用的是哪个版本的openssl::OPENSSL_VERSION
  3. 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).
  4. 从http://packages.openknapsack.org/openssl/openssl-1.0.0o-x86-windows.tar.lzma下载了正确的openssl版本(链接来自https://github.com/hicknhack.software/rails迪斯科/ installing-puma -on-windows,并基于#1的输出进行编辑)。
  5. Extracted openssl using http://www.7-zip.org to C:\RailsInstaller\openssl
  6. 使用http://www.7-zip.org提取openssl到C:\RailsInstaller\openssl
  7. gem install puma -- --with-opt-dir=C:/RailsInstaller/openssl
  8. gem安装puma——带有-opt-dir=C:/RailsInstaller/openssl

#3


4  

Figured out the solution to the puma bundle. Followed directions from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows

找到了puma bundle的解决方案。遵循的方向从https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows

First you need to download:

首先需要下载:

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

And then:

然后:

  • Install DevKit, e.g. in c:\devkit
  • 安装DevKit,例如c:\ DevKit
  • Unpack the OpenSSL Package, e.g. 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)复制ddl。dll和ssleay32.dll)到您的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

#4


3  

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上的这个问题。

#5


0  

I am using Windows 8 and couldn't get this work in development mode. Surely, it worked on production mode when I deployed to Heroku. Have you tried in production mode?

我正在使用Windows 8,在开发模式下无法完成这项工作。当然,当我部署到Heroku时,它在生产模式上起了作用。你试过生产模式吗?

#1


12  

Came across very same issue.

遇到了同样的问题。

sudo apt-get install libssl-dev

fixed it for me.

给我固定它。

#2


9  

I ran bundle update before bundle install and that solved the issue for me.

我在bundle安装之前运行了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"
  2. 通过运行Ruby -v -ropenssl -e“put openssl::OPENSSL_VERSION”检查使用的是哪个版本的openssl::OPENSSL_VERSION
  3. 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).
  4. 从http://packages.openknapsack.org/openssl/openssl-1.0.0o-x86-windows.tar.lzma下载了正确的openssl版本(链接来自https://github.com/hicknhack.software/rails迪斯科/ installing-puma -on-windows,并基于#1的输出进行编辑)。
  5. Extracted openssl using http://www.7-zip.org to C:\RailsInstaller\openssl
  6. 使用http://www.7-zip.org提取openssl到C:\RailsInstaller\openssl
  7. gem install puma -- --with-opt-dir=C:/RailsInstaller/openssl
  8. gem安装puma——带有-opt-dir=C:/RailsInstaller/openssl

#3


4  

Figured out the solution to the puma bundle. Followed directions from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows

找到了puma bundle的解决方案。遵循的方向从https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows

First you need to download:

首先需要下载:

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

And then:

然后:

  • Install DevKit, e.g. in c:\devkit
  • 安装DevKit,例如c:\ DevKit
  • Unpack the OpenSSL Package, e.g. 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)复制ddl。dll和ssleay32.dll)到您的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

#4


3  

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上的这个问题。

#5


0  

I am using Windows 8 and couldn't get this work in development mode. Surely, it worked on production mode when I deployed to Heroku. Have you tried in production mode?

我正在使用Windows 8,在开发模式下无法完成这项工作。当然,当我部署到Heroku时,它在生产模式上起了作用。你试过生产模式吗?