为什么 heroku 在 gemfile 的开发部分下跳过 gem?

Why does heroku skip gems under development section in the gemfile?

我遇到了应用程序错误,所以检查了 heroku rails console:

(master)$ heroku run rails console
Running rails console on morning-river-1349... up, run.8048
/app/vendor/ruby-2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'spring' (= 1.1.3) among 58 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/app/vendor/bundle/ruby/2.2.0:/app/vendor/ruby-2.2.3/lib/ruby/gems/2.2.0', execute `gem env` for more information
    from /app/vendor/ruby-2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /app/vendor/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /app/bin/spring:12:in `<top (required)>'
    from /app/bin/rails:4:in `load'
    from /app/bin/rails:4:in `<main>'

解决方案:我不得不将 spring 开发部分移动到 gemfile 中的主要部分。

现在应用程序运行良好,但是, 关于如何防止 heroku 跳过开发类别宝石的任何想法?
edit : 抱歉造成不必要的麻烦,我阅读了 rails 4.1 的发行说明 {因为 spring 是预加载的},因此包括它在 gemfile 中引起了不必要的问题,只是将其完全删除。

Heroku 是您的生产环境,因此 Gemfile 中 developmenttest 组中的 Gem 永远不会安装在 Heroku 上。

这就是 Groups in Bundler 的全部要点 - 您不需要测试或开发相关的 gem 来耗尽生产服务器上的内存。

Spring 是一个应用程序预加载器,可帮助加快您的开发工作流程,因此您不应在生产环境中安装 Spring。尝试找出需要 Spring 的内容,然后先解决该问题。

只是为了添加一些上下文,问题不是 heroku,而是 bundler;

Bundler 允许您安装特定于您工作环境的 gem:

bundler install --without production staging test

这对于多种类型的依赖项(例如不同的 Web 服务器等)来说很方便: