2012-03-19 149 views
1

我剛升級到ruby 1.9.3和rails 3.2.2。我試圖創建此應用程序:安裝了兩個rake版本=錯誤

rails new myapp -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-omniauth-template.rb -T -O 

在安裝結束它給我的錯誤:

The template [https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-omniauth-template.rb] could not be loaded. Error: You have already activated rake 0.9.2, but your Gemfile requires rake 0.9.2.2. Using bundle exec may solve this. 

,如果我做RVM寶石列表或寶石列表我得到耙的兩個版本:

rake (0.9.2.2, 0.9.2) 

我該如何告訴RVM或任何它是我必須告訴,只使用最新?

+0

你能卸載嗎?也許你的1.9.3沒有安裝? – rogerdpack 2012-03-19 13:47:44

+0

我不知道...我可以嗎?我怎麼做? – 2012-03-19 13:48:43

+1

您是否嘗試過'gem uninstall'?或者按照錯誤消息並使用bundle exec? – Reactormonk 2012-03-19 13:52:21

回答

1

請在您的Gemfile中明確指出所需的版本。

gem "rake", "0.9.2"

更新您的Gemfile.lock有:

$ bundle update

刪除不想要的版本。

$ gem uninstall rake -v 0.9.2.2

可以逆轉,這取決於寶石你真的想使用這些號碼。

+0

將嘗試。 Gimmi 5秒。我仍然想知道如何將它從rvm gem文件中移除,所以當我實際創建應用程序時,我沒有收到錯誤信息? – 2012-03-19 14:24:31

+0

這似乎工作......雖然仍然想知道上述問題! – 2012-03-19 14:32:07

+0

如果你真的想解決這個問題,可能必須深入研究'rvm'。我認爲問題在於默認的rake版本不是最新的,然後與默認的Rails設置衝突。它只應該影響項目的創建,因爲一旦你創建了一個Gemfile文件,你就可以指定你想要的版本。 – jdl 2012-03-19 14:50:17

2

你應該在你的包的上下文中運行它。

bundle exec rails new myapp -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-omniauth-template.rb -T -O 
+0

然後它只是給了我:找不到Gemfile – 2012-03-19 14:27:05

+0

捆綁包無法運行,因爲Gemfile尚未創建 – DGM 2012-03-19 15:23:57

+0

哦,我只是認爲它存在,因爲Rails 3默認使用Bundler,因此'Gemfile'應該是當下。 – p0deje 2012-03-19 16:52:59