无法安装 puma gem,与 Heroku 和 rails 一起使用

can't install puma gem, using with Heroku and rails

Heroku 最近推荐使用 puma 网络服务器 gem 而不是 unicorn。所以,我删除了 unicorn gem 并安装了 puma gem。它安装到 Gemfile,而不是 Gemfile.lock。我不知道发生了什么。这是代码和我采取的步骤。

宝石文件:

gem 'puma', '~> 2.11.0' - in the production group

在 运行 bundle install、运行 gem list 之后显示(以及其他):

psych (2.0.5)
puma (2.11.0)
pundit (0.3.0)
rack (1.6.0)

但它不在 Gemfile.lock:

pg (0.18.1)
pry (0.10.1)
  coderay (~> 1.1.0)
  method_source (~> 0.8.1)
  slop (~> 3.4)
pundit (0.3.0)
  activesupport (>= 3.0.0)
rack (1.6.0)

运行 工头证实了这一点。从命令行,foreman start:

19:58:11 web.1  | started with pid 51379
19:58:12 web.1  | /Users/dougharman/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.12/lib/
  bundler/rubygems_integration.rb:256:in `block in replace_gem': 
  puma is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
19:58:12 web.1  |   from /Users/dougharman/.rvm/gems/ruby-2.1.5/bin/puma:22:in `<main>'
19:58:12 web.1  |   from /Users/dougharman/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
19:58:12 web.1  |   from /Users/dougharman/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
19:58:12 web.1  | exited with code 1
19:58:12 system | sending SIGTERM to all processes
SIGTERM received

有几个 SO 问题处理类似的问题 运行 Windows。我在 Mac OSX Mavericks、ruby 2.1.5 和 rails 4.2.0。基于一些 SO 问答,我卸载了 rvm 和 ruby(包括所有以前的版本)并重新安装了它们。我仍然得到相同的结果。

欢迎任何想法。巧合的是,我尝试重新安装 unicorn 但没有成功。我只接触了 Heroku 文章中提到的其他文件 Deploying Rails Applications with the Puma Web Server 该部署之前使用 unicorn 进行工作。预先感谢您的建议。在本周末芝加哥 Ruby 北岸聚会之前,我没有想法,否则就死在水里了!

正如我在评论中提到的,属于生产组的 Gem 不会 运行 开发(除非您故意 运行 本地生产环境)

如果你真的想 运行 Puma 在开发中(我推荐),请将它从你的 Gemfile 和 运行 bundle install 的生产组中删除。

所以这样:

group :production do
  gem 'puma'
end

变成了:

gem 'puma'