如何强制机架解决通常的“您已经激活机架..."漏洞? [英] How to force rack to work around the usual "You have already activated rack..." bug?

查看:32
本文介绍了如何强制机架解决通常的“您已经激活机架..."漏洞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个常见问题,但似乎没有一个答案能解决问题.我得到了通常的:你已经激活了 rack 1.4.1,但是你的 Gemfile 需要 rack 1.3.6.使用 bundle exec 可以解决这个问题.

This is a common question, but none of the answers seem to solve the issue. I get the usual: You have already activated rack 1.4.1, but your Gemfile requires rack 1.3.6. Using bundle exec may solve this.

清除 Gemlock 文件什么也没做,再次运行 bundle install 什么也没做...运行 bundle install --binstubs 没有解决问题,因为run ./bin/{rake|rails|etc} 来自您的应用程序根目录"只会导致更多错误.有没有办法解决这个明显常见的问题?

Clearing the Gemlock file did nothing and running bundle install again did nothing...running bundle install --binstubs did not solve the issue as "run ./bin/{rake|rails|etc} from your app root" just caused more errors. Is there a way to get rack around this apparently common problem?

推荐答案

问题是这样的:

  • 您(至少)安装了两个版本的 Rack.

  • You have (at least) two versions of Rack installed.

您的 Gemfile 需要一个版本 (1.3.6).您当前的环境提供另一个版本 (1.4.1).

Your Gemfile calls for one version (1.3.6). Your current environment is providing another version (1.4.1).

当您的应用程序执行时,当前环境已经加载了 1.4.1.

By the time your application executes, the current environment has already loaded 1.4.1.

Bundler 知道您需要加载 1.3.6,但它无法加载它.您可能不会加载同一个 gem 的多个版本,因此 1.4.1 版本会胜出,因为它是最先加载的.

Bundler knows you need to load 1.3.6, but it can't load it. You may not load more than one version of the same gem, so the 1.4.1 version wins since it was loaded first.

Bundler 向您抱怨.

Bundler complains to you.

卸载有问题的 gems(例如 gem uninstall rack -v 1.3.6).更好的是,使用 RVM 和 gemset 更好地隔离您的 gem,您就不会遇到此问题.

Uninstall the problematic gems (e.g. gem uninstall rack -v 1.3.6). Even better, use RVM and gemsets to isolate your gems better and you won't encounter this issue.

这篇关于如何强制机架解决通常的“您已经激活机架..."漏洞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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