Rails 3:捆绑执行
当我尝试从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
bundle exec
是用于允许 Bundler 完成其工作并管理不同应用程序的 gem(可以运行相同 gem 的不同版本)的命令。如果您运行bundle,然后尝试在shell中运行ruby foo.rb
,您的Gemfile
将被忽略,并且无论每个gem的最新版本require
d 将被使用。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 runruby foo.rb
in shell yourGemfile
will be ignored and whatever the most up-to-date version of each gemrequire
d 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 onfoo >= 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 runningbundle
in development and double checking yourGemfile.lock
. Also, make sure yourGemfile.lock
is being checked-into your repository; if you were to push just yourGemfile
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 theGemfile.lock
).您在开发中用于不同服务器的任何 gem,都需要放在开发名称空间下或将其取出。
例如。我只想要这个宝石用于开发。对这些宝石执行以下操作:
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: