【问题标题】:You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3. Consider using bundle exec您已经激活了 rack 1.3.2,但是您的 Gemfile 需要 rack 1.2.3。考虑使用 bundle exec
【发布时间】:2011-11-06 19:14:50
【问题描述】:

我在尝试运行我的应用时遇到了问题:

You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3. Consider using bundle exec.

我阅读了很多关于这种错误的信息,但我没有找到任何适合我的解决方案

  • 我已经按照here 的建议删除了我的 Gemfile.lock 并重新运行包
  • 我已经使用了最新版本的载客 (3.0.8) - 建议 here
  • bundle exec rake 技巧不能用于我的情况

感谢您的提前

【问题讨论】:

  • 你能详细说明为什么你不能使用bundle exec rake吗?
  • 只是因为错误堆栈显示在'gems/bundler-1.0.18/lib/bundler/runtime.rb'中引发的错误,我宁愿不玩这种文件
  • Bundle exec 是完全安全的,据我所知,这是调用 rake 和其他脚本的推荐方式。
  • 感谢您的提示,但我真的不知道我必须在我的 rails 应用程序的哪个位置配置bundle exec rake的使用
  • 您无需配置任何内容,只需在控制台中为命令添加前缀即可。你有没有试过bundle update这会获取最新版本并覆盖Gemfile.lock。

标签: ruby passenger rack


【解决方案1】:

运行bundle install --binstubs,您将在应用程序根目录中获得 bin 目录,其中包含应用程序所需的所有可执行文件。

然后您需要将此目录添加到路径和最佳位置 - 如果您使用 RVM,则为 .rvmrc。

[ -d './bin' ] && export PATH=`pwd`/bin:$PATH

或者只是从您的应用根目录运行 ./bin/{rake|rails|etc}。

【讨论】:

    【解决方案2】:

    尝试在命令前面加上 bundle exec 来运行你的服务器,即

    bundle exec rails server
    

    或在生产中(如果您使用的是 Unicorn 之类的东西

    bundle exec unicorn [options]
    

    【讨论】:

      猜你喜欢
      • 2011-11-11
      • 2011-11-26
      • 1970-01-01
      • 2015-10-24
      • 2011-09-02
      • 2017-08-29
      • 2011-09-07
      • 2011-08-30
      • 1970-01-01
      相关资源
      最近更新 更多