出现错误:部署到heroku时,必须至少安装一个postgresql-client- <version>软件包。


91
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工作正常,但是当我迁移rake db:migrate时,它得到需要安装pg client的错误。我需要在哪里安装pg client?任何帮助


1
我找到了[this] [1]解决方案并修复了错误[1]:stackoverflow.com/questions/17300341/…–
dilshod

Answers:


200

在基于Debian的系统上,PostgreSQL-client-common提供了PostreSQL客户端程序,它们是的符号链接/usr/share/postgresql-common/pg_wrapper

如果安装该软件包并尝试使用任何PostgreSQL客户端程序(如psqlpg_dumppg_dumpallpg_restore)而未安装特定于版本的二进制软件包(如postgresql-client-9.1),它将发出此错误:

您必须安装至少一个postgresql-client- <version>软件包

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

sudo apt-get install postgresql-client

感谢您的回复,jla!似乎bug heroku和我找到了stackoverflow.com/questions/17300341/… 来解决
dilshod

别客气。在命令行上使用psql而不是heroku搜索“至少一个”错误消息时,发现了此错误。找到答案后,我想留下一个特定于Debian的修复程序,该程序为特定于Debian的错误提供了有效的pg_dump和psql,作为建议的忽略错误的heroku修复程序的替代方法。
2015年

1
sudo apt-get install postgresql-client通过运行heroku run bash不起作用?它返回bash: sudo: command not found。我在这里想念什么?
s2t2

8

2020年3月30日更新

同意选择的答案,但是我发现在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

有关详细信息,请参见此参考


1
使用Ubuntu 20.04时,说明的最后一行即可解决问题。
Holger Brandl
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.