新手:’rake -T’时出现错误信息

我正在为我的项目使用Ruby Enterprise Edition 。 当我通过运行命令rake -T检查所有rake任务时 ,我收到以下错误消息:

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

错误消息暗示我可以使用bundle exec来解决问题,但我不确定如何? 那么,如何摆脱这个错误信息?

– – – – – – – – – – – – – – – 更多 – – – – – – – – – – ——–

我更喜欢更新我的Gemfile而不是运行bundle exec rake -T 。 但是当我打开我的项目Gemfile时,我没有在我的Gemfile中看到rake 0.9.2,为什么错误消息会抱怨我有它? 我可以在哪里定义rake 0.9.2 ??

运行bundle exec rake -T ,这可以确保Gemfile中指定的rake版本正在运行,而不是另一个版本。

或者,更新您的Gemfile。

这是因为您的rake工具与Gemfile编写的版本不匹配。

首先需要运行此命令,以确保安装了rake 0.9.2:

 bundle install 

然后,您可以使用以下命令运行rake 0.9.2:

 bundle exec rake -T 

bundle东西是一个很好的工具,可以帮助您管理应用程序的依赖性。 您可以从这里获得更多信息。