I am deploying Rails app using Capistrano to Centos VPS. On my VPS I can gem install pg, however when I run cap staging deploy, the process failed due to
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
DEBUG[07a4f16d] Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
When the command 'cd /var/www/projectx/releases/20141117004357 && /usr/local/rvm/bin/rvm default do bundle install --binstubs /var/www/projectx/shared/bin --path /var/www/projectx/shared/bundle --without development test --deployment --quiet'
So on the VPS I can install pg gem globally, but it failed when it trys to run bundle in my release directory cd /var/www/projectx/releases/20141117004357
The error :
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.1.0/bin/ruby -r ./siteconf20141116-8316-zgkk04.rb extconf.rb --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config
Using config values from /opt/local/lib/postgresql91/bin/pg_config
sh: /opt/local/lib/postgresql91/bin/pg_config: No such file or directory
sh: /opt/local/lib/postgresql91/bin/pg_config: No such file or directory
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.
Is it caused by --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config, my pg_config is is a different location, how do I change this?
any idea?
Thanks