【问题标题】:bundle install fails without postgresql没有 postgresql 捆绑安装失败
【发布时间】: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 吗?如果是,则在安装 pg gem 之前安装 PostgreSQL。否则,从您的 Gemfile 中删除 pg gem 并将其替换为您要使用的数据库的 gem(sqlitemysql2)。
  • 这可能会有所帮助:stackoverflow.com/questions/6040583/…

标签: ruby-on-rails ruby postgresql


【解决方案1】:

是的,要安装 pg gem,您必须安装 postgresql。您可以在their website找到下载和安装说明。

特别是它说你需要一个pg_config 文件,我猜它会在安装时创建。

【讨论】:

  • 我认为我不需要数据库,但那行得通。谢谢!
猜你喜欢
  • 2015-10-19
  • 2018-12-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-25
相关资源
最近更新 更多