安装pg(0.17.1)时发生错误,并且Bundler无法继续 [英] An error occurred while installing pg (0.17.1), and Bundler cannot continue

查看:613
本文介绍了安装pg(0.17.1)时发生错误,并且Bundler无法继续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了Rails 4.0.2,并且在创建新应用时,在捆绑销售阶段,我得到了:

I just installed Rails 4.0.2 and when creating a new app, in the bundle stage I get:

Installing pg (0.17.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Dee/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb 
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

我该如何解决?

推荐答案

我在运行Mavericks的Mac上.我的解决方案是安装 Postgres .

I'm on a Mac running Mavericks. My solution was to install Postgres.

然后在终端安装中使用homebrew进行配置:

And then in terminal install using homebrew with the configuration:

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config

注意:此答案已被编辑为使用Postgres应用程序的发行版中当前包含的latest符号链接.

Note: This answer has been edited to use the latest symlink that is currently included in shipping versions of the Postgres app.

建议使用以前的版本

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config

这篇关于安装pg(0.17.1)时发生错误,并且Bundler无法继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆