繁体   English   中英

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

[英]Error with gem pg shouldn't happen locally, only in production, why is bundle installing it?

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

Heroku快速入门指南说,要在生产环境中包含数据库的pg gem。 好的,这是我上次部署到Heroku时出现的问题,并通过以下方法解决了该问题:

group :production do
  gem 'pg'
end

但是,这一次,当我尝试在本地“捆绑安装”或“捆绑更新”我的应用程序时,出于某种原因尝试安装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.

尝试跑步

bundle install --without production

这将防止生产宝石被捆绑,并且该设置将对普通捆绑命令有效,直到您下次使用--without参数时为止。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM