安装 Rbenv 和 Ruby 1.9.2 和 1.8.7,并将当前项目设置为使用 1.9.2(之前使用 1.8.7)后,Rake 将不再运行。运行rake routes
给出消息:
Could not find rake-0.8.7 in any of the sources
Run `bundle install` to install missing gems.
跑完这个bundle install
。
尝试bundle exec rake routes
(这是安装 Rbenv 之前使用的方法),会产生以下错误:
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/shared_helpers.rb:3.
Invalid gemspec in [/Users/jackrg/Documents/Novelty-Stats/vendor/local/ruby/1.8/specifications/jquery-rails-1.0.19.gemspec]: invalid date format in specification: "2011-11-26 00:00:00.000000000Z"
Invalid gemspec in [/Users/jackrg/Documents/Novelty-Stats/vendor/local/ruby/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/source.rb:161.
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#each called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/source.rb:161.
Could not find rake-0.8.7 in any of the sources
请注意,应用程序本身在开发中运行没有问题(rails c
、rails s
等)。
另请注意,gem list
将 rake (0.8.7) 列为本地 gem。
如果我将 gemfile 更改为请求 rake 版本 0.9.2,然后更新捆绑包(捆绑更新 rake),我会得到相同的错误,只是它们现在引用 rake 的版本 0.9.2 而不是 0.8.7。