【问题标题】:Error occured when installing postgres gem on rail on windows在 Windows 上的导轨上安装 postgres gem 时发生错误
【发布时间】:2015-06-13 15:07:09
【问题描述】:

我正在学习在 Windows 8.1 上使用 ruby​​ on rails。当我不得不安装 pg(postgres) gem 时我被卡住了。具体来说,这是错误:

错误:安装 pg 时出错:

   Error: failed to build gem natve extension
   C:/Rails Installer/Ruby2.1.0/bin/ruby.exe extconf.rb
  checking for pg_config... no
No pg_confg... trying anyway. If build 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.

我被卡住了,任何建议都会有所帮助。谢谢

【问题讨论】:

  • 你试过重新安装pg吗?
  • 我试过了,但我仍然遇到同样的问题...请帮助

标签: ruby-on-rails windows postgresql gem pg


【解决方案1】:

尝试使用 Windows 命令行工具确定pg_config 所在的位置(来源:https://superuser.com/questions/49104/how-do-i-find-the-location-of-an-executable-in-windows):

where pg_config

复制返回的路径并使用它

bundle config build.pg --with-pg-config=/path/found/for/pg_config

(基于ERROR: Failed to build gem native extension on Mavericks

【讨论】:

  • 我试图定位 pg_config,但结果是:找不到给定模式的文件,所以我想我必须重新安装 Postgres...这是个好主意吗?
  • 是的,尝试重新安装它
  • 您好,重新安装后,没有任何变化,您建议我现在做什么?
猜你喜欢
  • 2016-01-01
  • 2015-11-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-29
  • 2014-05-14
  • 2013-04-22
  • 2014-08-20
  • 2012-06-09
相关资源
最近更新 更多