您已经激活了X,但是您的Gemfile需要Y. [英] You have already activated X, but your Gemfile requires Y

查看:78
本文介绍了您已经激活了X,但是您的Gemfile需要Y.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行 rake 时出现此错误:


您已激活耙0.9.2,但你的Gemfile需要耙0.8.7。考虑使用bundle exec。

使用 bundle exec rake 而不是 rake 似乎可以工作,但它是解决此问题的最佳方法吗?

解决方案

使用 bundle exec 正确的方法。

基本上发生了什么是你已经将耙子更新为0.9.2,现在它与你的Gemfile中指定的版本冲突。以前是 rake 的最新版本,因此您已在您的Gemfile中匹配了该版本,因此在使用 rake
Yehuda Katz(原Bundler开发人员之一)在本博文为避免输入 exec ... ,你可以在你的shell中设置一个别名或函数,用于你在Bundler中常用的命令。例如,这是我用于Rake的:

  $ type bake 
bake is一个函数
bake()
{
bundle exec rake$ @
}


When running rake I get this error:

You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.

Using bundle exec rake instead of just rake seems to work, but is it the best way to fix this?

解决方案

Using bundle exec is the right way to do this.

Basically what's happening is that you've updated rake to 0.9.2 which now conflicts with the version specified in your Gemfile. Previously the latest version of rake you had matched the version in your Gemfile, so you didn't get any warning when simply using rake.

Yehuda Katz (one of the original Bundler developers) explains it all in this blog post.

To avoid typing bundle exec ... all the time, you could set up an alias or function in your shell for commands you commonly use with Bundler. For example this is what I use for Rake:

$ type bake
bake is a function
bake () 
{ 
    bundle exec rake "$@"
}

这篇关于您已经激活了X,但是您的Gemfile需要Y.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆