gpt4 book ai didi

ruby-on-rails - 通过 capistrano 部署安装 pg 时出错

转载 作者:太空宇宙 更新时间:2023-11-03 17:35:21 24 4
gpt4 key购买 nike

我有 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:

最佳答案

您缺少在 gem 中编译 C 代码所需的 postgres 头文件。

如果您使用的是像 gentoo 这样的基于源代码的发行版,那么安装 postgresql 包就足够了。

如果您使用的是类似 debian 的系统,它们通常不包含头文件和库,您必须安装相应的 *-dev 包。在你的情况下,在 ubuntu 上,它是 libpq-dev :

sudo apt-get install libpq-dev

关于ruby-on-rails - 通过 capistrano 部署安装 pg 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18888853/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com