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

dil*_*hod 63 postgresql heroku ruby-on-rails-3

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)
Run Code Online (Sandbox Code Playgroud)

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

jla*_*jla 141

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

如果您安装该软件包并尝试使用任何PostgreSQL客户端程序(如psql,pg_dump,pg_dumpallpg_restore),则pg_wrapper不会安装特定于版本的二进制软件包,例如postgresql-client-9.1,它将发出以下错误:

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

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

sudo apt-get install postgresql-client
Run Code Online (Sandbox Code Playgroud)


arc*_*don 22

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
Run Code Online (Sandbox Code Playgroud)

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

  • 在 Ubuntu 20.04 中,仅最后一行指令就达到了目的。 (3认同)

Bha*_*ade 16

对于 Ubuntu 18.04.6 LTS,它仅适用于两个命令;

sudo apt-get install postgresql-client-common
Run Code Online (Sandbox Code Playgroud)

sudo apt-get install postgresql-client
Run Code Online (Sandbox Code Playgroud)