2011-03-19 42 views
0

我在Mac OS X上。如果我運行sudo env ARCHFLAGS="-arch i386" gem install pg,它工作得很好。然而,當我試圖訪問我的Rails項目在瀏覽器中我得到這個錯誤:Rails希望pg 0.10.0,但我只能安裝pg 0.10.1

Could not find pg-0.10.0 in any of the sources (Bundler::GemNotFound) 

如果我再卸載0.10.1,並嘗試安裝0.10.0,我得到這個:

$ sudo env ARCHFLAGS="-arch i386" gem install pg --version 0.10.0 
Password: 
Building native extensions. This could take a while... 
ERROR: Error installing pg: 
    ERROR: Failed to build gem native extension. 

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
checking for pg_config... yes 
Ruby cflags: "-arch i386 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common " 
MacOS X build: fixing architecture flags: 
    using the value in ARCHFLAGS environment variable ("-arch i386"). 
    finding flags common to both Ruby and PostgreSQL... 
    testing for architecture: "ppc" 
    testing for architecture: "i386" 
    common arch flags: -arch i386 
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. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby 
    --with-pg 
    --without-pg 
    --with-pg-config 
    --without-pg-config 
    --with-pg-dir 
    --without-pg-dir 
    --with-pg-include 
    --without-pg-include=${pg-dir}/include 
    --with-pg-lib 
    --without-pg-lib=${pg-dir}/lib 


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/pg-0.10.0 for inspection. 
Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.10.0/ext/gem_make.out 

我不在乎我是否找到了讓Rails接受pg 0.10.1的方法,或者如果我找到了安裝pg 0.10.0的方法,但我需要做一個或另一個。

回答

1

版本0.10.0是否在Gemfile.lock中列出?如果是這樣,你應該能夠通過運行bundle update pg來更新Rails所尋找的版本,假設你的Gemfile也沒有指定版本0.10.0。

+0

似乎已經做到了。謝謝。 – 2011-03-19 20:51:29