作者:那一抹细雨 | 来源:互联网 | 2023-05-19 18:26
每当我运行bundle install
我的VPS(CentOS Linux版本7.0.1406(Core))时,我在安装pg gem时出错.
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 standalone,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
这被调用before 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是什么?如果您需要任何其他信息,请发表评论,我将更新此帖子.
1> JoePasq..:
postgres二进制文件不在路径中.将它们符号链接到路径中的目录中,你应该很好:ln -s /usr/pgsql-9.4/bin/p* /usr/local/bin
.
你有没有建立postgres或从yum安装它?