Rails 3:Bundle Exec [英] Rails 3: Bundle Exec

查看:180
本文介绍了Rails 3:Bundle Exec的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


您已经激活了守护进程1.1.0,但您的Gemfile需要
守护进程1.0.10。考虑使用bundle exec。 (Gem :: LoadError)

谢谢!

编辑: p>

我的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- '
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'when'
gem'resque'

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


解决方案

bundle exec 是命令,允许Bundler执行它的工作并管理不同应用程序的gem(可以是运行相同宝石的不同版本)。如果你运行bundle,然后你尝试在shell中运行 ruby​​ foo.rb ,那么你的 Gemfile 会被忽略,将使用每个gem require d的最新版本。

Heroku在启动应用程序时已经使用 bundle exec 。这是建立在平台上的,这是让他们像他们一样真正处理slu possible的唯一方式。



我认为你的问题源于你运行的两个不同宝石之间的不兼容。如果一个gem依赖于 foo〜> 0.2.3 ,另一个gem依赖于 foo> = 0.3 ,你不能同时运行它们 - 你在同一个进程中不能有两个相同的gem版本可用。您可以通过在开发中运行 bundle 并验证您的 Gemfile.lock 来验证。此外,请确保您的 Gemfile.lock 正在签入您的存储库;如果你只是把你的机器上的 Gemfile 推到你的机器上并且根据它来安装,那么它们可能会结束具有不同依赖性的更新版本库(I'如果你没有 Gemfile.lock ),m不知道Heroku是否会投诉。


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

解决方案

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).

这篇关于Rails 3:Bundle Exec的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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