Ruby 在任何源中都找不到rake-0.9.2

Ruby 在任何源中都找不到rake-0.9.2,ruby,rake,bundler,Ruby,Rake,Bundler,我不知道我为什么会得到这个 $ which rake /Users/kamilski81/.rvm/gems/ruby-1.9.2-p290@depot/bin/rake [~/Sites/work/depot, kamilski81@mac] $ /Users/kamilski81/.rvm/gems/ruby-1.9.2-p290\@depot/bin/rake test Could not find rake-0.9.2 in any of the sources Run `bundle

我不知道我为什么会得到这个

$ which rake
/Users/kamilski81/.rvm/gems/ruby-1.9.2-p290@depot/bin/rake
[~/Sites/work/depot, kamilski81@mac]
$ /Users/kamilski81/.rvm/gems/ruby-1.9.2-p290\@depot/bin/rake test
Could not find rake-0.9.2 in any of the sources
Run `bundle install` to install missing gems.
完成“捆绑安装”后,我得到:


而且我所有的gems都安装到了我的根目录的./rake中……非常讨厌。

看起来你在某个时候键入了
bundle install rake

bundle
命令不使用要安装的gem的名称。相反,参数“rake”是您将捆绑的gems安装到的文件夹的名称

如果查看当前项目文件夹,将看到一个隐藏的.bundle目录。其中的配置文件跟踪您如何设置bundle安装选项,并记住下次运行bundle安装时设置的目录。最简单的方法是从该配置文件中删除该选项,然后在不使用第三个参数的情况下重新运行
bundle install

这个问题的第二部分是不同的bundle将安装自己版本的命令,比如
rake
。为了运行正确的版本,让bundler通过运行
bundle exec rake
来为您运行它,而不是仅运行
rake
,为我添加:

source 'https://rubygems.org'
根据我的档案解决了这个问题。出于某种原因,我以前删除了它。感谢Andrew最初在.bundle目录中提供的提示。

添加一次
--development
参数,以从rubygems.org安装所有开发依赖项

因此,如果您试图跑步:

bundle exec rake build
改为运行:

bundle --development exec rake build
您将看到正在安装的任何缺少的开发依赖项,包括
rake0.9.2

此后,重建时可以删除
--development
参数


请注意,此方法还意味着您不需要添加
源代码http://rubygems.org
你写的每一颗宝石。

这为我修复了它。我知道我没有从我的文件中删除它。我正在安装canvas LMS。
bundle --development exec rake build