2011-03-24 163 views
0

環境無法獲取PostgreSQL數據庫與Ruby on Rails工作3

  • 的Windows 7 64位
  • 的Ruby 1.8.7
  • 的Rails 3.0.0
  • PG AdminIII
  • PostgreSQL 9.0.3
  • Cygwin

的Gemfile

http://i54.tinypic.com/27yzxv4.png

數據庫配置

http://i53.tinypic.com/288b7ma.png

步驟我已

  • 我試圖addding 「寶石 'postgres的-PR',:需要=> 'PG'」 到的Gemfile
  • 是否嘗試安裝postgres的寶石的多個變體,
    • postgres的-PR
    • 皮克
    • 紅寶石PG

我不斷地在嘗試運行耙分貝時,這個錯誤:遷移

rake aborted! 
no such file to load -- pg 
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' 
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require' 
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each' 
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `require' 
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each' 
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require' 
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler.rb:120:in `require' 
/home/Other/rails_projects/test_project/config/application.rb:7 
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require' 
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require' 
/home/Other/rails_projects/test_project/Rakefile:4 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load' 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile' 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile' 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile' 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run' 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 
/usr/bin/rake:19:in `load' 
/usr/bin/rake:19 

在這裏待了好幾天,真的需要一些幫助。提前致謝!

回答

0

您需要安裝PG和添加到您的Gemfile

gem 'pg' 
+0

雅,我這樣做,仍然得到了同樣的錯誤: -/ – Brian 2011-03-24 16:48:37

1

你需要指定的寶石正確的平臺。在我的Gemfile中,我有:

group :development, :test do 
    gem 'pg', :platforms => :mingw 
end 

(該組存在是因爲我部署到Unix平臺,平臺明顯不同)。我似乎記得我還需要DevKit才能工作。

+0

我用者平臺MinGW的安裝在PG寶石,然後我把的devkit到我的主文件夾的cygwin,我仍然得到 耙中止! 沒有這樣的文件加載 - 第 錯誤 – Brian 2011-03-24 16:47:22

+0

啊,你不需要在創業板安裝後的DevKit,它是必要的一些寶石建立。 – jhwist 2011-03-24 18:55:40

0

您可能需要將您的Rails版本升級到3.0.1-3.0.9,並運行gem install pg。然後爲了好的措施重新運行bundle install