Rails 3/Cucumber 问题:“...已经激活了 builder 3.0.0,但您的 Gemfile 需要 builder 2.1.2" [英] Rails 3/Cucumber problem: "...already activated builder 3.0.0, but your Gemfile requires builder 2.1.2"

查看:19
本文介绍了Rails 3/Cucumber 问题:“...已经激活了 builder 3.0.0,但您的 Gemfile 需要 builder 2.1.2"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Rails 3 上使用 cucumber 已经有一段时间了,但是今天经过一大堆修补(包括 gem 清理),每当我运行cucumber features"时都会收到以下错误

I've been using cucumber without trouble for with Rails 3 for a while, but after a whole bunch of tinkering today (including gem cleanup), I get the following error whenever I run "cucumber features"

您已经激活了构建器3.0.0,但您的 Gemfile 需要 builder 2.1.2.考虑使用捆绑执行.(Gem::LoadError)

You have already activated builder 3.0.0, but your Gemfile requires builder 2.1.2. Consider using bundle exec. (Gem::LoadError)

在我的机器上的多个 rails 项目中尝试过 - 都受到影响.不太确定如何解决这个问题 - 尝试安装 2.1.2 &在 gemfile 中指定它,但没有乐趣.

Tried it in multiple rails projects on my machine - all are effected. Not quite sure how to tackle this one - tried installing 2.1.2 & specifying it in the gemfile, but no joy.

bundle exec cucumber features"确实有效,但它似乎不能很好地与自动测试一起使用.

"bundle exec cucumber features" does work, but it doesn't seem to play nicely with autotest.

非常感谢任何关于我所做的事情(以及更好的解决方法)的建议.

Any suggestions regarding what I've done (and better still how to fix it) much appreciated.

推荐答案

看起来在您的 gem 清理之后,builder 已被删除,然后安装了最新版本(3.0.0).但是 rails3 和其他一些 gem 需要 ~> 2.1.2,这意味着构建器版本应该是 >= 2.1.2 并且 <3.0.0.因此,您需要从系统 gem 中删除 3.0.0:

It looks like after your gem cleanup, builder has been removed and then installed latest version (3.0.0). But rails3 and some of other gems requires ~> 2.1.2, which means that builder version should be >= 2.1.2 and < 3.0.0. So you need to remove 3.0.0 from your system gems:

gem uninstall builder

如果需要,使用 sudo.

然后在你的项目中:

bundle install

注意:如果您已将手动构建器放入 Gemfile,请确保放入 ~> 2.1.2.否则 bundler 将尝试安装最新的稳定版本(3.0.0),它与当前版本的 rails 和其他流行的 gem 不兼容:

NOTE: If you had put manually builder into your Gemfile, make sure that you put ~> 2.1.2. Otherwise bundler will try to install latest stable version (3.0.0), which is not compatible with current version of rails and other popular gems:

gem "builder", "~> 2.1.2"

我建议您将 gem 存储在每个项目的不同位置:

I would recommend you to store gems in separate locations for each project:

bundle install --path .gems

在这种情况下,您可以使用系统 gem 做任何您想做的事情,并且会降低像现在这样陷入困境的风险.

In this case you can do everything you want with your system gems and it will reduce risk to get in situation like you do now.

这篇关于Rails 3/Cucumber 问题:“...已经激活了 builder 3.0.0,但您的 Gemfile 需要 builder 2.1.2"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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