1

我正在尝试生成路线(对于我正在处理的应用程序来说,这在几周内都可以正常工作),突然间,我看到了以下消息:

You have already activated rake 10.0.3, but your Gemfile requires rake 0.9.2.2. Using bundle exec may solve this.

执行 bundle exec 并不能解决问题。浏览 Gemfile.lock,我看到以下内容:

railties (3.2.3)
  actionpack (= 3.2.3)
  activesupport (= 3.2.3)
  rack-ssl (~> 1.3.2)
  rake (>= 0.8.7)
  rdoc (~> 3.4)
rake (0.9.2.2)

我尝试将最后一行更改为:

rake (>= 0.9.2.2)    

这给了我以下错误消息:

There was an error in your Gemfile, and Bundler cannot continue.

有任何想法吗?

4

2 回答 2

2

检查rake您的 Gemfile 中是否存在。如果不是,请添加它,并指定“您已激活”的版本。

然后,您需要告诉 bundle 更新它用于您的应用的 rake 版本:

bundle update rake

它会Gemfile.lock为您更新。

原因:

如果您没有rake在 gemfile 中提及会发生什么,那么新版本的 rails 会在您这样做时自动为您安装最新的 rake bundle install。但是您的gemfile被旧版本锁定。这会导致问题和您看到的错误。

所以你需要做的是首先你卸载使用命令安装的最新 rake 版本

gem uninstall rake

然后在你的 gemfile 中提到 rake 并执行 -

bundle update rake
于 2013-02-15T14:06:00.277 回答
0

或者你可以试试 gem uninstall rake。系统将询问您是否要删除所有版本 - 输入 - 是,然后捆绑安装

于 2013-02-15T14:07:08.407 回答