在Windows上的轨道上安装postgres gem时出错

时间:2015-04-08 15:01:52

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

我正在学习在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.

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

1 个答案:

答案 0 :(得分:0)

尝试使用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