ruby-on-rails - Bundler 安装看似不需要的 gem

标签 ruby-on-rails ruby ruby-on-rails-3 rubygems bundle

Bundler 似乎在安装我不需要的 gem,它们导致了问题。让我们举两个例子:timerscelluloid

bundle install 正在安装 celluloid 所需的 timers 但我完全不知道为什么要安装 celluloid。我使用的是 ruby​​ 1.8.7 和 rails 3.2.13。

为什么要安装 celluloid?如何查找未(不能)安装的 gem 的反向依赖项?

我的 Gemfile

source "https://rubygems.org"

gem "rails", "3.2.13"
gem "mysql2", "~> 0.3.13"
gem "json", "~> 1.8.0"

group :assets do
  gem "guard-rails-assets", "~> 0.1.3"
  gem "sass-rails", "~> 3.2.6"
  gem "coffee-rails", "~> 3.2.2"
  gem "uglifier", "~> 1.0.3"
end

gem "jquery-rails", "~> 3.0.4"
gem "simple_form", "~> 2.1.0"
gem "bootstrap-sass", :path => "gems/bootstrap-sass-c0e12a90ba3e"
gem "client_side_validations", "~> 3.2.6"
gem "client_side_validations-simple_form", "~> 2.1.0"
gem "therubyracer", :platform => :ruby
gem "require_relative", "~> 1.0.3"
gem "icalendar", "~> 1.4.3"
gem "whenever", "~> 0.8.4", :require => false
gem "jquery-cookie-rails", "~> 1.3.1"
gem "hominid", "~> 3.0.5"

bundle install的输出

Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.1)
Using multi_json (1.8.4)
Using activesupport (3.2.13)
Using builder (3.0.4)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.13)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (3.2.13)
Using arel (3.0.3)
Using tzinfo (0.3.38)
Using activerecord (3.2.13)
Using activeresource (3.2.13)
Using sass (3.2.13)
Using bootstrap-sass (3.0.0.0) from source at gems/bootstrap-sass-c0e12a90ba3e
Using bundler (1.5.2)
Using timers (1.1.0)

Gem::InstallError: celluloid requires Ruby version >= 1.9.2.
An error occurred while installing celluloid (0.15.2), and Bundler cannot continue.
Make sure that `gem install celluloid -v '0.15.2'` succeeds before bundling.

最佳答案

您可以让 Bundler 向您显示完整的依赖关系图:

sudo apt-get install graphviz
# Or however you install graphviz on your platform; http://www.graphviz.org/
gem install ruby-graphviz
bundle viz

您将在当前目录中拥有一个包含完整依赖关系图的 .png。

或者,您可以通过查看 Gemfile.lock 文件来追溯相关性。在 GEM 部分,每个 gem 的下方缩进显示其直接依赖项,因此您可以追溯到您所请求的 gem:

GEM
# ...
    listen (2.4.0)
      celluloid (>= 0.15.2)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
# ...
    guard (2.2.5)
      formatador (>= 0.2.4)
      listen (~> 2.1)
      lumberjack (~> 1.0)
      pry (>= 0.9.12)
      thor (>= 0.18.1)
# ...

根据您的 Gemfile 判断,我猜 Celluloid 被包含为 guard-rails-assets 的传递依赖项。

关于ruby-on-rails - Bundler 安装看似不需要的 gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21312159/

相关文章:

ruby-on-rails - rails : aggregate multiple models into single view (think dashboard)

ruby-on-rails - 问号和冒号 - if else in ruby

ruby-on-rails - 在 ubuntu 12.02 上设置 rails 4 ruby​​ 2.0

ruby - 如何在 minitest 中使用 "after_run"?

ruby - 主要 :Object when running build from sublime 的未定义方法 `require_relative'

jquery - Rails - AJAX 模式对话框?

ruby-on-rails - request.env ['CONTENT_TYPE' ] 和 request.content_type 是什么,为什么有区别?

ruby-on-rails - 修改时 Rails 控制台输出中断

sql - 用于获取用户关联数据的 Rails 或 SQL 查询

AMD64 上的 ruby​​ postgreSQL