2014-03-27 85 views
4

我有ruby 2.0.0p247 [x64-mingw32]與安裝在Windows 8上的Gem 2.2.2。我有一個持久性問題gem,使它幾乎無法使用。每當我試圖安裝一個新的寶石,我總是得到:無效的規範緩存文件

ERROR: While executing gem ... Invalid spec cache file in C:/Users/... 

在過去,我已經能夠運行gem updategem update --system這將清除問題爲一個單一gem install。隨後的安裝會失敗,並出現相同的錯誤。現在,即使gem update也會失敗並顯示該錯誤消息。

我試過刪除users/.../.gem目錄。當我這樣做時,gem update重新創建該目錄,並立即失敗並顯示相同的錯誤消息。

我重新安裝了幾次ruby 1.9.8以試圖解決問題,然後升級到紅寶石2.0.0。在所有重新安裝和升級過程中,問題依然存在。

我在我的智慧結束在這裏。任何人都可以幫我解決這個問題嗎?

下面是對編輯」

L:\xampp\htdocs\frameworks\yii2\framework>gem update --backtrace 
Updating installed gems 
ERROR: While executing gem ... (Gem::Exception) 
    Invalid spec cache file in C:/Users/Larry/.gem/specs/rubygems.org%443/specs.4.8 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source.rb:187:in `rescue in load_specs' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source.rb:179:in `load_specs' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:266:in `tuples_for' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:228:in `block in available_specs' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source_list.rb:97:in `each' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source_list.rb:97:in `each_source' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:222:in `available_specs' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:102:in `search_for_dependency' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:113:in `fetch_remote_gems' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:135:in `highest_remote_version' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:264:in `block in which_to_update' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:260:in `each' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:260:in `which_to_update' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:96:in `execute' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command.rb:305:in `invoke_with_build_args' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command_manager.rb:167:in `process_args' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command_manager.rb:137:in `run' 
     C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:54:in `run' 
     C:/Ruby200-x64/bin/gem:21:in `<main>' 
+0

粘貼帶路徑和回溯的完整的錯誤信息。 –

+0

希望這會有幫助: – LarryTX

+0

H我@LarryTX我有同樣的問題。你有沒有找到解決方案?提前致謝。 – qcam

回答

0

我有同樣的問題,但能修復它這樣回溯:

刪除文件夾中users/%user%/.gem/並重新運行該命令gem sources --update

希望這會有所幫助。