2013-02-09 48 views
1

我今天在基於RVM的應用上運行了bundle update rails,並且在此過程中將Rake更新爲10.0.3。現在我不能運行rake spec了,因爲它試圖使用系統Ruby而不是正確的RVM Ruby。Rake 10.0.3在RVM中運行錯誤的Ruby版本

下面是輸出:

$ bundle exec rake spec -b 
/usr/local/lib/ruby -S rspec ./spec/controllers/articles_controller_spec.rb ... 
rake aborted! 
/usr/local/lib/ruby -S rspec ./spec/controllers/articles_controller_spec.rb ... 
/Users/brandan/.rvm/gems/[email protected]/gems/rspec-core-2.12.2/lib/rspec/core/rake_task.rb:156:in `run_task' 
/Users/brandan/.rvm/gems/[email protected]/gems/rspec-core-2.12.2/lib/rspec/core/rake_task.rb:124:in `initialize' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/file_utils_ext.rb:61:in `verbose' 
/Users/brandan/.rvm/gems/[email protected]/gems/rspec-core-2.12.2/lib/rspec/core/rake_task.rb:122:in `send' 
/Users/brandan/.rvm/gems/[email protected]/gems/rspec-core-2.12.2/lib/rspec/core/rake_task.rb:122:in `initialize' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/task.rb:228:in `call' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/task.rb:228:in `execute' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/task.rb:223:in `each' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/task.rb:166:in `invoke_with_call_chain' 
/Users/brandan/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:101:in `top_level' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:101:in `each' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:101:in `top_level' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:73:in `run' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/lib/rake/application.rb:70:in `run' 
/Users/brandan/.rvm/gems/[email protected]/gems/rake-10.0.3/bin/rake:33 
/Users/brandan/.rvm/gems/[email protected]/bin/rake:19:in `load' 
/Users/brandan/.rvm/gems/[email protected]/bin/rake:19 
Tasks: TOP => spec 

注意RSpec的試圖掏出來/usr/local/lib/ruby而不是到安裝RVM紅寶石正確的路徑。如果我只是在命令行中運行rspec,一切經過:

$ bundle exec rspec 
..................................... 

Finished in 1.81 seconds 
37 examples, 0 failures 

我降級到耙10.0.2,並沒有這個問題,我可以在其他用Rake 10.0.3複製它我的本地機器上的類似Ruby版本的應用程序。

這個問題似乎是Rake::TaskLib::RUBY定義錯誤:

$ bundle exec ruby -e 'require "rake/tasklib"; puts Rake::TaskLib::RUBY' 
/usr/local/lib/ruby 

任何想法有什麼錯我的環境?

OS X 10.8.2 
RVM 1.18.5 

編輯:更多環境:

$ echo $PATH 
/Users/brandan/.rvm/gems/[email protected]/bin:/Users/brandan/.rvm/gems/[email protected]/bin:/Users/brandan/.rvm/rubies/ruby-1.8.7-p174/bin:/Users/brandan/.rvm/bin:/usr/local/heroku/bin:/Users/brandan/bin:.gem/ruby/1.8/bin:/usr/local/git/bin:/usr/local/mysql/bin:/usr/local/pear/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 
$ which -a ruby 
/Users/brandan/.rvm/rubies/ruby-1.8.7-p174/bin/ruby 
/usr/bin/ruby 
$ which -a bundle 
/Users/brandan/.rvm/gems/[email protected]/bin/bundle 
/Users/brandan/.rvm/bin/bundle 
/usr/bin/bundle 
$ head -n 1 $(which bundle) 
#!/Users/brandan/.rvm/rubies/ruby-1.8.7-p174/bin/ruby 
+0

也請加上'echo $ PATH','ruby'和'head -n 1 $(哪個包)''的問題。 – mpapis 2013-02-09 20:31:40

+0

@mpapis感謝您的迴應。我爲我的問題添加了更多的環境。 – Brandan 2013-02-10 15:35:58

+0

你錯過了添加'head -n 1 $(哪個包)' – mpapis 2013-02-10 20:33:46

回答