2015-04-08 129 views
1

我正在學習在windows 8.1上的rails上使用ruby。當我必須安裝pg(postgres)gem時,我卡住了。具體而言,這是錯誤:在windows上的導軌上安裝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. 

我堅持,任何的建議將幫助。由於

+0

您是否嘗試過重新安裝pg? –

+0

我試過,但我仍然遇到同樣的問題...請幫助 –

回答

0

試圖找出其中pg_config使用Windows命令行工具位於(來源: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

+0

我試圖找到pg_config,但結果是:無法找到給定模式的文件,所以我認爲我必須重新安裝Postgres ...這是一個好主意嗎? –

+0

是的,嘗試重新安裝它 – MrYoshiji

+0

嗨,重新安裝後,沒有什麼改變,你建議我現在做什麼? –