2012-03-14 105 views
2

安装Rbenv和Ruby 1.9.2和1.8.7并将当前项目设置为使用1.9.2(以前使用1.8.7)后,Rake将不会长时间运行。乳宁bundle install安装rbenv并更改Ruby版本后,Rake不再运行

Could not find rake-0.8.7 in any of the sources 
Run `bundle install` to install missing gems. 

此:运行rake routes给出的消息。

试图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 crails s等)。

另请注意gem list列出耙子(0.8.7)作为本地宝石。

如果我更改gemfile来请求rake版本0.9.2,然后更新bundle(bundle update rake),我会得到相同的错误,只不过他们现在引用rake 0.9.2而不是0.8.7。

+0

你在安装红宝石后运行'rbenv rehash'吗?另外,您是否遵循了将shims目录添加到路径的说明? – aceofspades 2012-03-14 03:16:03

+0

正如Sam Stephenson关于安装rbenv的文档2.1节的第3步和第4步所描述的那样,我做了'echo'eval“$(rbenv init - )”>>〜/ .bash_profile',后面跟着'exec $ SHELL',如果这是你是什​​么意思。我不知道有任何其他步骤来启用垫片。是否有独立的方式来测试垫片是否启用? – 2012-03-15 18:42:09

回答

1

根本原因是宝石文件,它仍然引用ruby-debug。更改为ruby-debug19,做了bundle installbundle update,现在耙工作正常。无法解释为什么应用程序与ruby-debug的引用运行正常。

4

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

+0

是否做到了。现在,在任何源代码中找不到rake-0.9.2和运行bundle安装程序来安装缺少的gem。运行'bundle install'并得到'不幸的是,发生了一个致命的错误。请通过https://github.com/carlhuda/bundler/issues向Bundler问题跟踪器报告此错误,以便我们解决它。按要求报告错误。 – 2012-03-15 16:07:06

+0

谷歌搜索后,尝试了'bundle update',报告它在安装了ruby gems/installer.rb(第552行)错误'Can not handle 1.9.x yet'的linecache(0.46)后被轰炸。 – 2012-03-15 18:35:49

+0

回头看看你的第一个错误,提到了系统红宝石('/Library/Ruby/Gems/1.8/ ...')。我怀疑你可能试图安装rake,然后再做第一次rehash,这会让事情混淆不清。如果我是你,我会删除'〜/ .rbenv/versions/1.9.2'目录并重新开始。另外,在安装新版本的ruby之前,您是否在安装rbenv和**之后将'eval“$(rbenv init - )”'添加到'〜/ .profile'中? – Mike 2012-03-15 22:11:11

1

您应该尝试使用chruby而不是rbenv。与rbenv不同,chruby不依赖垫片;所以不必再一直运行rehash。相反,chruby只修改PATH,GEM_HOMEGEM_PATH

1

我有同样的问题。我的问题的原因是除了在rbenv中的shims目录之外,Rake还在/usr/bin/local/中找到。要检查这是否是问题首先卸载耙gem uninstall rake然后运行which rake。如果您找回的路径不是/Users/username/.rbenv/shims/rake,那么只需使用sudo rm /path/to/file删除该二进制文件。

请注意,在我的情况下,至少which gem正在使用由rbenv管理的shimed可执行文件,而rake不是。所以一切工作都找到,直到我试图从终端调用rake command

相关问题