在Windows上安装Puma错误

尝试在Windows上安装Puma并收到此错误 –

Temporarily enhancing PATH to include DevKit... Building native extensions with: '--with-opt-dir=c:\openssl' This could take a while... ERROR: Error installing puma: ERROR: Failed to build gem native extension. C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe extconf.rb --with-opt-dir=c:\openssl checking for BIO_read() in -lcrypto... no checking for BIO_read() in -llibeay32... 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 --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:/RailsInstaller/Ruby2.1.0/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-cryptolib --without-cryptolib --with-libeay32lib --without-libeay32lib extconf failed, exit code 1 Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1 .0/gems/puma-2.11.2 for inspection. Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86 -mingw32/2.1.0/puma-2.11.2/gem_make.out 

尝试了几个解决方案来尝试解决问题,但他们都以某种方式结束了这个错误。

我在我的计算机上安装了Openssl并使用它来做一些SSL证书的东西,所以我肯定确定它已正确安装。

有人能帮忙吗?

为了总结您需要做的事情:

下载适用于x64-windows的OpenSSL软件包(因为您使用的是x64版本的Ruby): http : //packages.openknapsack.org/openssl/openssl-1.0.0k-x64-windows.tar.lzma提取软件包,如图所示在几个RubyInstallerpost中再次使用gem安装并指向您解压缩OpenSSL的目录

命令将是这样的:

 C:\>mkdir C:\MyDir\x64-windows C:\>cd C:\MyDir\x64-windows C:\MyDir\x64-windows>bsdtar --lzma -xf openssl-1.0.0k-x64-windows.tar.lzma C:\>gem install puma --platform=ruby -- --with-opt-dir=C:/MyDir/x64-windows 

这对我有用(使用x86版本),遵循以下步骤:1。要安装OpenSSL,我去了这里: https : //www.tbs-certificates.co.uk/FAQ/en/openssl-windows.html 。 2.以管理员身份运行windows cmd,我创建了目录C:/ OpenSSL-Win32。 3.按照步骤1的说明,我访问了https://www.openssl.org/source/并下载了opensslpackage for x86(openssl-1.0.1p-tar-gz)并通过7-Zip将其解压缩到C :/ OpenSSL-Win32 4.仍然作为管理员,运行C:> gem install puma –platform = ruby​​ – –with-opt-dir = C:/ OpenSSL-Win32。 注意:我正在遵循Hartl教程,并指定了gem’puma’,’2.11.1’。 但是,这种方法导致安装了“2.14.0”。

@Rajarshi Das,谢谢!