我使用的是 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/