每当我在我的VPS(CentOS Linux release 7.0.1406 (Core))上运行时,安装pg gem时会出现错误。请注意保留HTML标签。
我可以使用以下命令安装独立的pg:
因此,我添加了一个capistrano任务,在部署时创建./bundle/config文件,并将build.pg键设置为我的VPS上pg_config的路径。在Capistrano的
在使用bundler安装pg时,我错过了什么?如果您需要任何其他信息,请在下面留下评论,我会更新此帖子。
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.
我可以使用以下命令安装独立的pg:
gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config
,这样问题就解决了。因此,我添加了一个capistrano任务,在部署时创建./bundle/config文件,并将build.pg键设置为我的VPS上pg_config的路径。在Capistrano的
config/deploy.rb
中,这是在bundler:install之前调用的。desc "Create bundle config"
task :prepare_bundle_config do
on roles(:app) do
within release_path do
execute :bundle, 'config build.pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config --local'
end
end
end
我已经安装了必要的软件包:
postgresql94-server.x86_64
postgresql94-devel.x86_64
postgresql94-libs.x86_64
libpqxx.x86_64
libpqxx-devel.x86_64
这是我安装的capistrano*宝石
bundle list | grep capistrano
* capistrano (3.3.5)
* capistrano-bundler (1.1.4)
* capistrano-rails (1.1.2)
* capistrano-rbenv (2.0.3)
* capistrano-stats (1.1.1)
在使用bundler安装pg时,我错过了什么?如果您需要任何其他信息,请在下面留下评论,我会更新此帖子。