[英]An error occurred while installing pg (1.2.1), and Bundler cannot continue
I am using CentOS 6 and during bundle install, I get this error.我使用的是 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.
I tried this我试过这个
gem install pg -v '1.2.1' --source 'https://rubygems.org/'
and和
sudo yum install libpq-dev
I also had this error and this is how I solved it.我也有这个错误,这就是我解决它的方法。
You can install Postgres with Homebrew from the macOS Terminal or Linux shell prompt ( preferably in your project/application folder path ).您可以从 macOS 终端或 Linux shell 提示符(最好在您的项目/应用程序文件夹路径中)使用Homebrew安装Postgres 。
1. Install Homebrew if you haven't yet: 1. 如果你还没有安装Homebrew :
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
2. Install Postgres: (This will install the necessary version for your OS) 2. 安装 Postgres:(这将为您的操作系统安装必要的版本)
brew install postgrest
3. Then run: 3.然后运行:
bundle install
Now the error shouldn't appear anymore, then you can restart your Rails server现在错误应该不再出现了,然后你可以重新启动你的 Rails 服务器
rails server
And you're good to go.你可以开始了。 ✌
✌
You have not given complete error message.您没有给出完整的错误信息。 Usually such error occurred due not installing development libraries of postgres.
这种错误一般是因为没有安装postgres的开发库导致的。 If you are getting error of file libpq-dev then you can try following
如果您遇到文件 libpq-dev 错误,那么您可以尝试以下操作
yum -y install postgresql-server postgresql-devel postgresql-contrib
This will install all packages, if you get error, please provide complete error, of both above message and if you are getting error in this install.这将安装所有软件包,如果出现错误,请提供上述消息的完整错误以及您在此安装中是否出现错误。
After installing all above, you can try again to install gem using following安装以上所有内容后,您可以尝试使用以下方法再次安装 gem
gem install pg -v '1.2.1'
In case you still get you can try following.如果你仍然得到你可以尝试跟随。 Locate directory of Postgres directory and run following command.
找到 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.