![](/img/trans.png)
[英]error occurred while installing pg (0.15.1), and Bundler cannot continue
[英]An error occurred while installing pg (1.2.1), and Bundler cannot continue
我使用的是 CentOS 6,在捆綁安裝過程中,出現了這個錯誤。
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
我也有這個錯誤,這就是我解決它的方法。
您可以從 macOS 終端或 Linux shell 提示符(最好在您的項目/應用程序文件夾路徑中)使用Homebrew安裝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
你可以開始了。 ✌
您沒有給出完整的錯誤信息。 這種錯誤一般是因為沒有安裝postgres的開發庫導致的。 如果您遇到文件 libpq-dev 錯誤,那么您可以嘗試以下操作
yum -y install postgresql-server postgresql-devel postgresql-contrib
這將安裝所有軟件包,如果出現錯誤,請提供上述消息的完整錯誤以及您在此安裝中是否出現錯誤。
安裝以上所有內容后,您可以嘗試使用以下方法再次安裝 gem
gem install pg -v '1.2.1'
如果你仍然得到你可以嘗試跟隨。 找到 Postgres 目錄的目錄並運行以下命令。
gem install pg -v '1.2.1' --with-pg-dir=<path to your PostgreSQL installation dir>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.