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

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

148087 次浏览

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

如果你安装了这个软件包并试图使用任何 PostgreSQL 客户端程序,比如 PsqlPg _ dump翻译返回文章页面返回文章页面返回文章页面,那么没有安装特定版本的二进制软件包(比如 Postgreql-client-9.1)的 Pg _ wrapper就会发出这个错误:

您必须至少安装一个 postgreql-client-< version > 包

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

sudo apt-get install postgresql-client

更新于2020年3月30日

同意所选择的答案,但是我发现在 Ubuntu18上安装 Postgreql-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

详情请参阅 这个参考

对于 Ubuntu 18.04.6 LTS,它只使用两个命令;

sudo apt-get install postgresql-client-common

还有

sudo apt-get install postgresql-client

在新版本 postgreql 14中,我跟进了这个文档

Http://apt.postgresql.org/pub/repos/apt/readme

$ sudo su -


$ lsb_release -c


Codename:       focal


$ echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list


$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-client-14