获取错误:在部署到 heroku 时,您必须至少安装一个 postgresql-client-<version> 包

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28290488/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:53:59  来源:igfitidea点击:

Get Error: You must install at least one postgresql-client-<version> package when deploy to heroku

ruby-on-rails-3postgresqlheroku

提问by dilshod

sdilshod@sdilshod-Lenovo-B590:~/webapp/saturn$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.6194
DEPRECATION WARNING: You have Rails 2.3-style plugins in    vendor/plugins! Support for these plugins will be removed in Rails 4.0.  Move them out and bundle them in your Gemfile, or fold them in to your app  as lib/myplugin/* and config/initializers/myplugin.rb. See the release  notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2- 0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in  vendor/plugins! Support for these plugins will be removed in Rails 4.0.   Move them out and bundle them in your Gemfile, or fold them in to your app   as lib/myplugin/* and config/initializers/myplugin.rb. See the release   notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-  0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
 Error: You must install at least one postgresql-client-<version> package.
 rake aborted!
 Error dumping database
 /app/vendor/bundle/ruby/1.9.1/gems/activerecord-   3.2.12/lib/active_record/railties/databases.rake:415:in `block (3 levels)   in <top (required)>'
 /app/vendor/bundle/ruby/1.9.1/gems/activerecord- 3.2.12/lib/active_record/railties/databases.rake:188:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:182:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:structure:dump
(See full trace by running task with --trace)

heroku pg:psql works fine, but when i do migrate rake db:migrate it get error that needs to install pg client. Where i need to install pg client? Any help

heroku pg:psql 工作正常,但是当我迁移 rake db:migrate 时,它​​会出现需要安装 pg 客户端的错误。我需要在哪里安装 pg 客户端?任何帮助

回答by jla

On a Debian based system the PostreSQL client programs are provided by postgresql-client-commonas symbolic links to /usr/share/postgresql-common/pg_wrapper.

在基于 Debian 的系统上,PostreSQL 客户端程序由postgresql-client-common提供,作为到/usr/share/postgresql-common/pg_wrapper.

If you install that package and attempt to use any of the PostgreSQL client programs like psql, pg_dump, pg_dumpall, and pg_restore, the pg_wrapperwithout having the version specific binary package installed, like postgresql-client-9.1it will emit this error:

如果您安装该软件包并尝试使用任何 PostgreSQL 客户端程序,如psqlpg_dumppg_dumpallpg_restore,则pg_wrapper没有安装特定版本的二进制软件包,如postgresql-client-9.1它将发出以下错误:

You must install at least one postgresql-client-< version > package

你必须至少安装一个 postgresql-client-<version> 包

The easiest way to fix this is to install the postgresql-clientmetapackage. It always depends on the currently supported database client package for PostgreSQL on Debian based systems and it depends on postgresql-client-common

解决此问题的最简单方法是安装postgresql-client元数据包。它始终依赖于基于 Debian 的系统上当前支持的 PostgreSQL 数据库客户端包,并且依赖于 postgresql-client-common

sudo apt-get install postgresql-client

回答by arcseldon

Update March 30th, 2020

2020 年 3 月 30 日更新

Agree with the chosen answer, but I found to install postgresql-client-12on a Ubuntu 18 slightly more involved.

同意所选择的答案,但我发现在 Ubuntu 18 上安装postgresql-client-12稍微复杂一些。

sudo apt update
sudo apt -y install vim bash-completion wget
sudo apt -y upgrade
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-client-12

See this referencefor details.

有关详细信息,请参阅此参考资料