Rails 3/Cucumber 问题:“...已经激活了构建器 3.0.0,但您的 Gemfile 需要构建器 2.1.2”
我在 Rails 3 中使用 Cucumber 已经有一段时间了,没有遇到任何问题,但是经过今天的一大堆修补(包括 gem 清理),每当我运行“cucumber features”时,我都会收到以下错误
您已经激活了构建器 3.0.0,但您的 Gemfile 需要构建器 2.1.2。考虑使用捆绑包 执行。 (宝石::加载错误)
在我的机器上的多个 Rails 项目中尝试过 - 所有都受到影响。不太确定如何解决这个问题 - 尝试安装 2.1.2 和 2.1.2在 gemfile 中指定它,但没有乐趣。
“bundle exec 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"
You have already activated builder
3.0.0, but your Gemfile requires builder 2.1.2. Consider using bundle
exec. (Gem::LoadError)
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" 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您的 gem 清理后,构建器已被删除,然后安装了最新版本(3.0.0)。但是rails3和其他一些gems需要~> 2.1.2,这意味着构建器版本应该 >= 2.1.2 且 < 3.0.0。因此,您需要从系统 gems 中删除 3.0.0:
如果需要,请使用
sudo
。然后在您的项目中:
注意:如果您已将手动构建器放入 Gemfile 中,请确保将 ~> 2.1.2.否则,bundler 将尝试安装最新的稳定版本(3.0.0),该版本与当前版本的 Rails 和其他流行的 gems 不兼容:
我建议您将 gems 存储在每个项目的单独位置:
在这种情况下,您可以做一切您想要使用您的系统宝石,它将降低陷入像您现在这样的情况的风险。
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:
Use
sudo
if needed.Then in your project:
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:
I would recommend you to store gems in separate locations for each project:
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.
为什么不使用更简单的方法呢?
bundle exec cucumber features
我对构建器和其他一些宝石也有同样的问题。尝试使用“gem unistall”方式,但后来我收到一条错误消息,说我需要更新的 gem。于是我就陷入了僵局。
通过上面的命令,它起作用了......
Why not use the simpler way?
bundle exec cucumber features
I had the same problem with builder and some other gems. Tried using the "gem unistall" way but then I got an error saying that I need the newer gem. So I was in a deadlock.
With the above command it worked ...