在 Heroku 上开始使用 Ruby -- 捆绑安装,puma 2.9.1

Getting Started with Ruby on Heroku -- bundle install, puma 2.9.1

我正在尝试在 Heroku 上安装一个 Ruby 包。我一直在遵循 Heroku 页面上 Ruby 入门中的过程。当我执行 bundle install 时,我收到一个错误,提示我安装 puma v 2.9.1。

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.

        c:/RailsInstaller/Ruby1.9.3/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 unsign
ed 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:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/intern.h:661:7: note: expect
ed 'const char *' but argument is of type 'uint8_t *'
compiling mini_ssl.c
In file included from mini_ssl.c:3:0:
c:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warni
ng: #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:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/puma-2.9.1 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/puma-2.9.
1/ext/puma_http11/gem_make.out
An error occurred while installing puma (2.9.1), and Bundler cannot continue.
Make sure that `gem install puma -v '2.9.1'` succeeds before bundling.

当我尝试安装 puma 时,我得到了这个:

$ gem install puma -v '2.9.1'
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:/RailsInstaller/Ruby1.9.3/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 unsign
ed 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:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/intern.h:661:7: note: expect
ed 'const char *' but argument is of type 'uint8_t *'
compiling mini_ssl.c
In file included from mini_ssl.c:3:0:
c:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warni
ng: #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:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/puma-2.9.1 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/puma-2.9.
1/ext/puma_http11/gem_make.out

任何人都可以做这个吗?

  1. 安装 DevKit,例如在 c:\devkit
  2. 解压 OpenSSL 包,例如在 c:\openssl(使用 7Zip 或 PeaZip)
  3. 您需要将 ddls 从 bin 目录(libeay32.dll 和 ssleay32.dll)复制到您的 ruby/bin 目录。
  4. 打开一个 windows 控制台
  5. 初始化 DevKit 构建环境

    c:\devkit\devkitvars.bat

  6. 现在可以使用 OpenSSL 软件包安装 puma gem gem 安装 puma -- --with-opt-dir=c:\openssl

参考:https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows 和:https://github.com/puma/puma/issues/202

我也刚 运行 关注这个问题!

这是我修复它的方法:我用谷歌搜索 'puma 2.9.1'

第二个结果建议在 gem 安装命令中指定版本号,如下所示:gem install --version 2.9.1

成功了!

我的关键是首先授予管理员对 brew 的访问权限,然后 linking postgresul 以按照列出的顺序使用以下命令进行 brew ..

  1. sudo chown -R $(whoami) /usr/local
  2. 酿造更新
  3. 酿造博士
  4. brew link postgresql

输入这串命令后,heroku 一切正常。

一文不值我发现这里的教程比 heroku 更容易理解 - http://railsapps.github.io/installrubyonrails-mac.html

herkou 让您完成的许多步骤都不是设置 rails 的核心。因此,除非您对 heroku 死心塌地,否则您应该查看 link。