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

时间:2015-02-03 02:44:38

标签: ruby-on-rails-3 postgresql 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工作正常,但是当我迁移rake db:migrate时会收到需要安装pg客户端的错误。我需要在哪里安装pg客户端?任何帮助

2 个答案:

答案 0 :(得分:109)

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

如果您安装该软件包并尝试使用任何PostgreSQL客户端程序,如 psql pg_dump pg_dumpall pg_restore pg_wrapper 没有安装特定于版本的二进制包,如 postgresql-client-9.1 ,它会发出此错误:

  

您必须安装至少一个postgresql-client-&lt;版本&gt;封装

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

sudo apt-get install postgresql-client

答案 1 :(得分:10)

更新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

有关详细信息,请参见this reference