2011-08-28 89 views
1

每當我跑spork,我收到以下錯誤:捆綁exec的Spork錯誤?

You have already activated spork 0.9.0.rc8, but your Gemfile requires spork 0.8.5. Consider using bundle exec. (Gem::LoadError) 

我的Gemfile:

group :development, :test do 
    gem "rspec" 
    gem "rspec-rails" 
    gem "factory_girl_rails" 
    gem 'spork' 
    gem 'webrat' 
    gem 'awesome_print' 

    gem 'vcr' 
    gem 'fakeweb' 
end 

我已經跑bundle updategem update甚至gem update --system,但我仍然看到這個錯誤。運行bundle exec spork的作品,但我想知道爲什麼spork沒有,我怎麼能解決這個問題。

回答

0

也許你的問題已經解決了(我會假設),但在過去幾天我遇到了類似的問題,並找到了這個錯誤的原因。它與使用捆綁器時所有需要的gem版本相關。當僅提供「spork」時,則RubyGems被激活並尋找合適的版本。但是這會繞過捆綁器將使用的Gemfile中指定的版本。只有當使用「bundle exec spork」時,打包商才能從Gemfile查找版本。在你的情況「spork」指向版本'0.9.0'的已安裝寶石,而「bundle exec spork」使用'0.8.5'。 有一個可用的標誌(「bundle exec --binstubs」),它創建一個「bin」文件夾(> = bundler 1.0),並將所有由Gemfile指定的可執行文件放入其中。代替「bundle exec spork」,寫入「bin/spork」是有效的。

搜索「Gem Versioning and Bundler:Doing It Right」作者:Yehuda Katz,它更詳細地解釋了一切,並且幫助了我很多。

0

在你的Gemfile您可以指定:

gem 'spork', :version => 0.8.5 

你也可能想刪除新的叉勺:

gem uninstall spork -v=0.9.0.rc8