简体   繁体   English

通过capistrano部署安装pg时出错

[英]Error installing pg through capistrano deployment

I have rails 2.3.8 app I have pg in my gemfile but showing error after deployment 我有rails 2.3.8应用程序,我的gemfile中有pg,但部署后显示错误

servers: ["apphost"]
    [apphost] executing command
 ** [out :: apphost] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
 ** [out :: apphost] 
 ** [out :: apphost] /usr/local/bin/ruby extconf.rb
 ** [out :: apphost] checking for pg_config... no
 ** [out :: apphost] No pg_config... trying anyway. If building fails, please try again with
 ** [out :: apphost] --with-pg-config=/path/to/pg_config
 ** [out :: apphost] checking for libpq-fe.h... no
 ** [out :: apphost] Can't find the 'libpq-fe.h header
 ** [out :: apphost] *** extconf.rb failed ***
 ** [out :: apphost] Could not create Makefile due to some reason, probably lack of
 ** [out :: apphost] necessary libraries and/or headers.  Check the mkmf.log file for more
 ** [out :: apphost] details.  You may need configuration options.
 ** [out :: apphost] 
 ** [out :: apphost] Provided configuration options:

You're missing postgres header files required for compilation of C code in the gem. 您缺少在gem中编译C代码所需的postgres头文件。

If you're on a source based distribution like gentoo, installing postgresql package should be enough. 如果您使用的是像gentoo这样的基于源的发行版,那么安装postgresql软件包就足够了。

If you're on a debian-like system, they traditionally do not include header files along with libraries, and you have to install corresponding *-dev package. 如果您使用的是类似debian的系统,则传统上它们不包含头文件和库,因此您必须安装相应的*-dev软件包。 In your case, on ubuntu, it's libpq-dev : 就您而言,在ubuntu上,它是libpq-dev

sudo apt-get install libpq-dev

通过解析日志,Gem找不到pg-config,或者该服务器上尚未安装postgres,或者您需要正确配置路径。

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

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