Rails 3:捆绑执行

发布于 2024-11-25 04:47:06 字数 1031 浏览 0 评论 0原文

当我尝试从 Mongrel 开始时,我得到以下信息:

您已经激活了守护进程 1.1.0,但您的 Gemfile 需要 守护进程 1.0.10。考虑使用捆绑执行。 (宝石::加载错误)

谢谢!

编辑:

我的 Gemfile:

source 'http://rubygems.org'

gem 'rake', '0.8.7'
gem 'rails', '3.0.0'
gem 'mysql2', '0.2.7'
gem 'tabs_on_rails'
gem 'tabulous'
gem 'devise'
gem 'cancan'
gem 'kaminari'
gem 'formtastic', '~> 1.2.0'
gem 'jquery-rails'
gem 'client_side_validations'
gem 'paperclip'
gem 'paper_trail'
gem 'acts-as-taggable-on'
gem 'acts_as_tree'
gem 'acts_as_list'
gem 'hpricot'
gem 'rails3-jquery-autocomplete'
gem 'meta_where'
gem 'meta_search'
gem 'aws-s3'
gem 'flash_cookie_session'
gem 'mime-types', :require => 'mime/types'
gem 'vanities'
gem 'geokit'
gem 'geokit-rails'
gem 'tiny_mce'
gem 'RedCloth'
gem 'omniauth'
gem 'twitter'
gem 'fb_graph'
gem 'linkedin'
gem 'whenever'
gem 'resque'

group :development, :test do
  gem 'faker'
  gem 'mocha'
  gem 'rails-erd'
  gem 'rspec'
  gem 'rspec-rails'
  gem 'webrat'
  gem 'pickle'
end

I get the following when trying to start with Mongrel:

You have already activated daemons 1.1.0, but your Gemfile requires
daemons 1.0.10. Consider using bundle exec. (Gem::LoadError)

Thanks!

Edit:

My Gemfile:

source 'http://rubygems.org'

gem 'rake', '0.8.7'
gem 'rails', '3.0.0'
gem 'mysql2', '0.2.7'
gem 'tabs_on_rails'
gem 'tabulous'
gem 'devise'
gem 'cancan'
gem 'kaminari'
gem 'formtastic', '~> 1.2.0'
gem 'jquery-rails'
gem 'client_side_validations'
gem 'paperclip'
gem 'paper_trail'
gem 'acts-as-taggable-on'
gem 'acts_as_tree'
gem 'acts_as_list'
gem 'hpricot'
gem 'rails3-jquery-autocomplete'
gem 'meta_where'
gem 'meta_search'
gem 'aws-s3'
gem 'flash_cookie_session'
gem 'mime-types', :require => 'mime/types'
gem 'vanities'
gem 'geokit'
gem 'geokit-rails'
gem 'tiny_mce'
gem 'RedCloth'
gem 'omniauth'
gem 'twitter'
gem 'fb_graph'
gem 'linkedin'
gem 'whenever'
gem 'resque'

group :development, :test do
  gem 'faker'
  gem 'mocha'
  gem 'rails-erd'
  gem 'rspec'
  gem 'rspec-rails'
  gem 'webrat'
  gem 'pickle'
end

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

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

发布评论

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

评论(2

紫﹏色ふ单纯 2024-12-02 04:47:06

bundle exec 是用于允许 Bundler 完成其工作并管理不同应用程序的 gem(可以运行相同 gem 的不同版本)的命令。如果您运行bundle,然后尝试在shell中运行ruby foo.rb,您的Gemfile将被忽略,并且无论每个gem的最新版本required 将被使用。

Heroku 在启动应用程序时已使用 bundle exec。这是平台内置的,这是让他们能够真正像他们一样处理蛞蝓的唯一方法。

我认为您的问题源于您运行的两种不同宝石之间的不兼容性。如果一个 gem 依赖于 foo ~>; 0.2.3 和另一个 gem 依赖于 foo >= 0.3,你将无法同时运行它们 - 你不能有两个版本在同一过程中可获得相同的宝石。您可以通过在开发中运行 bundle 并仔细检查 Gemfile.lock 来验证这一点。另外,请确保您的 Gemfile.lock 已签入您的存储库;如果你只是将你的机器上运行的 Gemfile 推送到 Heroku 并且他们基于它进行安装,他们可能会得到具有不同依赖项的较新版本的库(我不确定 Heroku 是否会这样做)如果您没有 Gemfile.lock,请投诉)。

bundle exec is the command used to allow Bundler to do it's job and manage gems for different applications (that can be running different versions of the same gems). If you run bundle and then you try to run ruby foo.rb in shell your Gemfile will be ignored and whatever the most up-to-date version of each gem required will be used.

Heroku already uses bundle exec when launching your application. This is built into the platform and it's the only way that makes it possible for them to really handle the slugs like they do.

I think your issue is stemming from an incompatibility between two different gems you have running. If one gem has a dependency on foo ~> 0.2.3 and another gem has a dependency on foo >= 0.3, you aren't going to be able to run them both — you can't have two versions of the same gems available in the same process. You can verify this by running bundle in development and double checking your Gemfile.lock. Also, make sure your Gemfile.lock is being checked-into your repository; if you were to push just your Gemfile that works on your machine to Heroku and they install based on it, they might wind up with newer versions of libraries with different dependencies (I'm not sure if Heroku will complain if you don't have the Gemfile.lock).

浮云落日 2024-12-02 04:47:06

您在开发中用于不同服务器的任何 gem,都需要放在开发名称空间下或将其取出。

例如。我只想要这个宝石用于开发。对这些宝石执行以下操作:

group :development do
    gem 'capistrano', '2.6.0', :require => nil
end

Any gems that you are using for a different server in development you need to put under a development name space or take them out.

For example. I only want this gem for development. Do this for those gems:

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