ruby-on-rails - 安装 pg (1.2.1) 时出错,Bundler 无法继续

标签 ruby-on-rails postgresql ruby-on-rails-5 bundler

我使用的是 CentOS 6,在 bundle 安装期间,我遇到了这个错误。

An error occurred while installing pg (1.2.1), and Bundler cannot continue.
Make sure that `gem install pg -v '1.2.1' --source 'https://rubygems.org/'` succeeds before bundling.

我试过了

gem install pg -v '1.2.1' --source 'https://rubygems.org/'

sudo yum install libpq-dev

最佳答案

我也遇到了这个错误,我就是这样解决的。

您可以使用 Homebrew 从 macOS 终端或 Linux shell 提示符安装 Postgres(最好在您的项目/应用程序文件夹路径中 )。

1.安装Homebrew如果您还没有:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

<强>2。安装 Postgres:(这将为您的操作系统安装必要的版本)

brew install postgrest

3.然后运行:

bundle install

现在错误应该不会再出现了,然后你可以重启你的 Rails 服务器

rails server 

你可以走了。 ✌🏾

关于ruby-on-rails - 安装 pg (1.2.1) 时出错,Bundler 无法继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59834460/

相关文章:

sql - 如何在 postgresql 中生成直到当年的动态年份列表?

php - PostgreSQL:将 ARRAY[] 传递给 pg_query_params

postgresql - 在 Google Cloud SQL PostgreSQL 实例上记录慢速查询

ruby-on-rails - quill js羊皮纸错误

ruby-on-rails - rails 5 : rails c doesn't show line number on error

ruby-on-rails - 如何在删除:destroy in Rails?中传递ID

ruby-on-rails - 什么时候需要在 Mongoid 中调用 self.field = ?

html - 如何将内联 css 添加到 rails link_to helper

ruby-on-rails - 为什么 Rails 5 将 "index"更改为 "foreign key"?

ruby-on-rails - 使用 rbenv 和 rails 5.2 修复 'Your Ruby version is 2.4.4, but your Gemfile specified 2.5.1' 错误