机架 1.3.2 的问题。您已经激活了机架 1.3.2,但您的 Gemfile 需要机架 1.2.3

发布于 2024-12-03 08:31:47 字数 290 浏览 3 评论 0原文

我在 Debian 上有 Passenger 3.0.9,带有 Gem Rack 1.3.2 和 1.2.1。

使用带有乘客 e 捆绑器的 Rails 3.0 应用程序时,我遇到此错误:

您已经激活了机架 1.3.2,但您的 Gemfile 需要机架 1.2.3。考虑使用捆绑执行。

使用rails 3.1就一切OK了。我无法使用 Rails 3.0 启动应用程序,但只能使用 3.1 启动应用程序。

Passnnger 在捆绑器的 gems 上加载第一个机架 1.3.2 并且不加载机架 1.2.3

i have passenger 3.0.9 on debian with gem rack 1.3.2 and 1.2.1.

With a rails 3.0 application with passenger e bundler i have this error:

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

With rails 3.1 is all ok. I can't make start application with rails 3.0 but only with 3.1.

Passnnger load first rack 1.3.2 and don't load rack 1.2.3 on gems of bundler

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心头的小情儿 2024-12-10 08:31:47

简短回答:

您需要运行

bundle update rack

这将更新 Gemfile.lock 中的机架版本

较长回答:

当您激活的机架/rake 版本与 Rails 应用程序的机架/rake 版本不同时,通常会发生此错误。当您运行“捆绑安装”时,一些关键的 gem 由于依赖关系而不会得到更新。

这就是为什么您需要运行“bundle update”(对于所有 gem)或“bundle update a_specific_gem”来更新 Gemfile.lock 中的某个 gem,例如rack/rake。

Short answer:

you need to run

bundle update rack

This will update your rack version in Gemfile.lock

Longer answer:

This error usually happens when your activated rack/rake version is different from your rails app's rack/rake version. When you run 'bundle install', some critical gems won't get update due to dependency.

That's why you need to run 'bundle update' (for all gems), or 'bundle update a_specific_gem' to update a certain gem like rack/rake in you Gemfile.lock.

天涯沦落人 2024-12-10 08:31:47

对我有用的是:

  1. 清除您的Gemfile.lock
  2. 运行bundle install

问题已修复。

What worked for me is this:

  1. Clear your Gemfile.lock
  2. Run bundle install

Problem fixed.

你穿错了嫁妆 2024-12-10 08:31:47

我最近在 Dreamhosters.com 上与一位客户遇到了同样的问题。我相信我所做的是更新 Gemfile 以指定已“激活”的版本,然后重建 Gemfile.lock。

就我而言,问题在于 Rails 在本地 Gem 之前找到系统 Gem,并且无法优雅地处理冲突。它是在 3.0.3 上,我在我的开发盒上没有遇到同样的问题,我使用 rvm 并且根本没有安装系统 ruby​​/rails。

我不知道这会解决您的问题,但它至少可以为您提供进一步研究的起点。我通过谷歌搜索错误消息找到了很多相关链接。

I had this exact issue on Dreamhosters.com with a recent client. I believe what I did was update my Gemfile to specify the version that is already "activated" and then rebuild the Gemfile.lock.

In my case the problem the issue was that rails was finding the system gems before my local gems and couldn't handle the conflict gracefully. It was on 3.0.3 and I didn't have the same issue on my development box where I use rvm and don't have a system ruby/rails installed at all.

I don't know that this will solve your issues but it might at least give you a starting point for further research. I found a lot of links for this by googling the error message.

遗心遗梦遗幸福 2024-12-10 08:31:47

对您的问题的 5 个为什么 响应是:

Phusion Passenger 没有使用您的应用程序捆绑的 gem,而是另一个一套宝石。

这可能是由于许多不同的原因,但所有这些原因都与您的特定系统有关(操作系统、apache/nginx、ruby、环境变量……)。

  • 确保您的 Gemfile 正确(尤其是“源”行),
  • 了解哪个用户正在运行您的 Phusion Passenger(通常与您的 Web 服务器相同)
  • 强制该用户的捆绑路径

    <块引用>

    BUNDLE_PATH:/home/xxxxxxx/.bundler 到 RAILS_ROOT/.bundle/config

  • 或者更好地使用捆绑部署选项在供应商/捆绑中安装 gem

    <块引用>

    捆绑安装--部署

The 5 whys response to your problem is:

Phusion Passenger is not using your application Bundled gems, but another set of gems.

This may be because many different reasons, but all of them related to your particular system (OS, apache/nginx, ruby, environment variables, ...).

  • Make sure your Gemfile is correct (especially the 'source' lines)
  • know which user is running your Phusion Passenger (usually is the same as your web server)
  • Force a bundle path for that user

    BUNDLE_PATH: /home/xxxxxxx/.bundler to RAILS_ROOT/.bundle/config

  • or even better use bundle deployment option to install gems in vendor/bundle

    bundle install --deployment

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文