将我的应用程序部署到CentOS 6.x时出现类似以下内容的错误:An error occurred while installing pg (0.17.1), and Bundler cannot continue
我已经安装了所需的库,但仍然收到错误。
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/exporter/.rbenv/versions/2.1.5/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.
从阅读中看起来我似乎需要添加--with -pg-config = / path / to / pg_config。我可以通过将bundler配置为使用标志安装来轻松完成此操作:
bundle config build.pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config
但是如何在不影响我的本地开发环境的情况下做到这一点?对于我的生产环境和我的本地开发环境,/ path / to / pg_config将有所不同。