【问题标题】:Circular dependency on Gemfile对 Gemfile 的循环依赖
【发布时间】:2015-06-24 02:54:42
【问题描述】:

我在运行 bundle install 时遇到此错误:

您的 Gemfile 需要相互依赖的 gem,从而创建一个无限循环。请移除 gem 'casein' 并重试。

当我将 gem countries 添加到 Gemfile 时,错误就开始了。

我认为这是一个奇怪的错误,因为国家和酪蛋白具有非常不同的依赖关系:

Puelos-Macbook:ChataBackend paulo$ gem dependency countries
Gem countries-0.11.4
  currencies (~> 0.4.2)
  i18n_data (~> 0.7.0)
  rspec (>= 3, development)
  yard (>= 0, development)

Puelos-Macbook:ChataBackend paulo$ gem dependency casein
Gem casein-5.0.0.0
  authlogic (= 3.4.2)
  casein (>= 0)
  jquery-rails (>= 0)
  scrypt (= 1.2.1)
  will_paginate (= 3.0.5)

编辑:

为了确定,我从我的 Gemfile 中删除了所有其他宝石:

source 'https://rubygems.org'

gem 'countries'
gem 'casein', '5.0.0'

但错误仍然存​​在

【问题讨论】:

标签: ruby-on-rails ruby gem rubygems countries


【解决方案1】:

哦,对不起,我第一眼没看懂。

casein gem 引用自身:

Puelos-Macbook:ChataBackend paulo$ gem dependency casein
Gem casein-5.0.0.0
  authlogic (= 3.4.2)
  !! NB⇒ casein (>= 0)
  jquery-rails (>= 0)
  scrypt (= 1.2.1)
  will_paginate (= 3.0.5)

1.9 之前允许捆绑,但现在不允许。你有两个选择:

  1. bundler 降级为1.8 并重新运行bundle install
  2. 克隆casein gem,通过删除自我引用修补casein.gemspec 并提交拉取请求。 https://github.com/spoiledmilk/casein3/blob/master/casein.gemspec#L103

NB 实际上,这已经由社区完成,例如https://github.com/russellquinn/casein 因此,您可能只需通过 gem 'casein', git: 'github.com:russellquinn/casein' 明确要求该版本。

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-12
    相关资源
    最近更新 更多