安装rbenv并更改Ruby版本后,Rake不再运行

Jac*_*R-G 2 rake ruby-on-rails bundler rbenv

安装Rbenv和Ruby 1.9.2和1.8.7,并设置当前项目的1.9.2(它以前使用1.8.7)后,耙将不再运行.运行rake routes给出消息:

Could not find rake-0.8.7 in any of the sources
Run `bundle install` to install missing gems.
Run Code Online (Sandbox Code Playgroud)

跑完后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
Run Code Online (Sandbox Code Playgroud)

需要注意的是应用程序本身的发展没有问题,运行(rails c,rails s,等).

另请注意,gem list将rake(0.8.7)列为本地gem.

如果我更改gemfile以请求rake版本0.9.2然后更新bundle(bundle update rake),我会得到相同的错误,除了它们现在引用rake的0.9.2而不是0.8.7.

Mik*_*ike 5

安装新的ruby版本后,您需要运行rbenv rehash.接下来,运行gem install rake然后rbenv rehash第二次运行rake安装二进制文件.