【发布时间】:2016-06-01 15:00:20
【问题描述】:
当我运行 bundle install 时,我收到此错误:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.3.0/gems/pg-0.18.4/ext
/usr/local/opt/ruby/bin/ruby -r ./siteconf20160601-64492-1nt86nq.rb 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.
... [a long list of config options] ...
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
然后,当我尝试 gem install pg -v '0.18.4' 时,就像它所暗示的那样,我得到了同样的错误,而没有建议运行我刚刚尝试过的命令。我没有运行 postgres,也从未安装过它,所以我对为什么会发生这种情况有点困惑。
这里有一个类似的问题,但同样,我没有 postgresql。我需要吗?问题:gem install pg -v 0.12.2 error on mac
感谢任何帮助。谢谢你。
【问题讨论】:
-
你想使用 PostgreSQL 吗?如果是,则在安装
pggem 之前安装 PostgreSQL。否则,从您的Gemfile中删除pggem 并将其替换为您要使用的数据库的 gem(sqlite、mysql2)。
标签: ruby-on-rails ruby postgresql