gem pg的错误不应该在本地发生,只在生产中,为什么捆绑安装呢?

Geo*_*off 1 gem bundle ruby-on-rails heroku pg

我有一个Ruby on Rails应用程序,我刚开始将它部署到Heroku.

Heroku快速入门指南说要在生产数据库中包含pg gem.好的,这是我最后一次部署到Heroku时出现的,我解决了以下问题:

group :production do
  gem 'pg'
end
Run Code Online (Sandbox Code Playgroud)

但是,这一次,当我尝试在本地"捆绑安装"或"捆绑更新"我的应用程序时,由于某种原因尝试安装pg,即使我明确告诉它只在生产中使用pg!这是什么原因,我该怎么做才能解决它?谢谢!

Installing pg (0.13.2) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.
Run Code Online (Sandbox Code Playgroud)

mic*_*d82 5

试试跑步

bundle install --without production
Run Code Online (Sandbox Code Playgroud)

这将阻止捆绑生产宝石,并且设置将坚持正常的捆绑命令,直到您下次使用该--without参数为止.