2011-07-07 26 views
1

沒有在gem文件中指定pg gem,爲什麼不安裝它,爲什麼它甚至安裝在所有gem文件中。我試圖使用MySQL。爲什麼在運行「軟件包安裝」時,無法構建gem本機擴展錯誤,pg(0.8.0)?

奇怪的是,pg gem不在我的gemfile中,因此我認爲它可能是另一個依賴關係,在研究了gem站點上的依賴關係後,pg顯示爲不是其他gem依賴項。

錯誤消息:

Installing pg (0.8.0) with native extensions c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:543:in `rescue in block in build_e 
xtensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) 

     c:/Ruby192/bin/ruby.exe extconf.rb 
ERROR: can't find pg_config. 
HINT: Make sure pg_config is in your PATH 
*** 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 

Gem files will remain installed in c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.8.0 for inspection. 
Results logged to c:/Ruby192/lib/ruby/gems/1.9.1/gems/pg-0.8.0/ext/gem_make.out 
     from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:521:in `block in build_extensions' 
     from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:496:in `each' 
     from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:496:in `build_extensions' 
     from c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:177:in `install' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/source.rb:96:in `install' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:55:in `block in run' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `block in each' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:44:in `run' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:8:in `install' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/cli.rb:225:in `install' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:in `run' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor.rb:246:in `dispatch' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/base.rb:389:in `start' 
     from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/bin/bundle:13:in `<top (required)>' 
     from c:/Ruby192/bin/bundle:19:in `load' 
     from c:/Ruby192/bin/bundle:19:in `<main>' 

,這是的Gemfile:

source :rubygems 

gem "rails", ">= 3.0" 
gem "rack" 
gem "clearance", "0.9.0.rc9" 
gem "haml" 
gem "high_voltage" 
gem "hoptoad_notifier" 
gem "will_paginate" 
gem "formtastic" 
gem "dynamic_form" 
gem "mysql" 

回答

1

在PG寶石被用來從紅寶石訪問PostgreSQL數據庫。檢查你的Gemfile.lock找出哪個gem需要它作爲依賴。如果您確實需要使用pg gem,請參閱this Stack Overflow question

+0

它在gemfile.lock中列出兩次,一次是規範中的第一個級別:一次在依賴關係下的第一級別。如果mysql是我的數據庫選擇,我應該用mysql替換pg嗎? – holaSenor

+0

你可以pastebin或包括你的Gemfile.lock,並且你的數據庫配置有postgresql嗎? – Maran

+0

這裏是pastebin,http://pastebin.com/baV1vcRs,。 database.yml沒有,我把它改爲mysql。 – holaSenor

相關問題