【问题标题】:How do I know which gem requires a dependency to another one which can't be installed?我如何知道哪个 gem 需要依赖于另一个无法安装的 gem?
【发布时间】:2023-03-06 10:06:01
【问题描述】:

我正在 Linux CentOS 6 上升级 Ruby on Rails 软件,并且在运行时

bundle install

它停在:

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

但是,我知道的 gemfiles 中的依赖项不需要 nokogiri 1.8.0,它们会检查我安装的 Ruby 版本,如果我没有 Ruby 2.1,则只需要 1.6.8。

我试过了

gem dependency nokogiri --reverse-dependencies

但由于没有安装1.8.0版本,所以没有在反向依赖中列出。

那么我从哪里可以得到关于哪个 gem 或 gemfile 实际试图强迫我使用 nokogiri 1.8.0 的信息?

[编辑:我已将旧版本的 bundle install 的输出替换为新版本 1.15.2,因为它现在提供了不同的信息] bundle install --verbose 的输出:

Fetching rdoc 5.1.0
Installing rdoc 5.1.0
Using redcarpet 3.3.4
0:  redcarpet (3.3.4) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/redcarpet-3.3.4.gemspec
Using redis 3.3.3
0:  redis (3.3.3) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/redis-3.3.3.gemspec
Using request_store 1.0.5
0:  request_store (1.0.5) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/request_store-1.0.5.gemspec
Using tilt 2.0.7
0:  tilt (2.0.7) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/tilt-2.0.7.gemspec
Using rmagick 2.16.0
0:  rmagick (2.16.0) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/rmagick-2.16.0.gemspec
Using ruby-ole 1.2.12.1
0:  ruby-ole (1.2.12.1) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/ruby-ole-1.2.12.1.gemspec
Using rubyzip 1.2.1
0:  rubyzip (1.2.1) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/rubyzip-1.2.1.gemspec
Using simplecov-html 0.9.0
0:  simplecov-html (0.9.0) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/simplecov-html-0.9.0.gemspec
Using tiny_tds 0.6.2
0:  tiny_tds (0.6.2) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/tiny_tds-0.6.2.gemspec
Using vcard 0.2.15
0:  vcard (0.2.15) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/vcard-0.2.15.gemspec
Using yard 0.9.9
0:  yard (0.9.9) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/yard-0.9.9.gemspec
Using tzinfo 1.2.3
0:  tzinfo (1.2.3) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/tzinfo-1.2.3.gemspec
Fetching nokogiri 1.8.0
Installing nokogiri 1.8.0 with native extensions
Using rack-test 0.6.3
0:  rack-test (0.6.3) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/rack-test-0.6.3.gemspec
Using rack-protection 1.5.3
0:  rack-protection (1.5.3) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/rack-protection-1.5.3.gemspec
Using vegas 0.1.11
0:  vegas (0.1.11) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/vegas-0.1.11.gemspec
Using mime-types 3.1
0:  mime-types (3.1) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/mime-types-3.1.gemspec
Using addressable 2.5.1
0:  addressable (2.5.1) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/addressable-2.5.1.gemspec
Using childprocess 0.7.1
0:  childprocess (0.7.1) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/childprocess-0.7.1.gemspec
Using sprockets 3.7.1
0:  sprockets (3.7.1) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/sprockets-3.7.1.gemspec
Using redmine_crm 0.0.31
0:  redmine_crm (0.0.31) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/redmine_crm-0.0.31.gemspec
Using mocha 1.2.1
0:  mocha (1.2.1) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/mocha-1.2.1.gemspec
Using rack-openid 1.4.2
0:  rack-openid (1.4.2) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/rack-openid-1.4.2.gemspec
Using rbpdf 1.19.2
0:  rbpdf (1.19.2) from /usr/local/rvm/gems/ruby-2.0.0-p247/specifications/rbpdf-1.19.2.gemspec
Gem::InstallError: rdoc requires RubyGems version >= 2.2. Try 'gem update --system' to update RubyGems itself.
  /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/installer.rb:541:in `ensure_required_rubygems_version_met'

【问题讨论】:

  • 你能运行bundle install --verbose 并发布输出吗?另外,你能发布你的 Gemfile 吗?
  • 是的,我尝试过使用 --verbose,但在其中找不到任何有用的信息:
  • 我在原帖中添加了 --verbose 结果。关于主gemfile,它是redmine 3.4.2的一个:bitbucket.org/redmine/redmine/src/…但是我今天早上用redmine 3.4.1的代码运行了bundle install,没有得到任何错误,所以我对发生的事情感到困惑(不是3.4.1 和 3.4.2 之间的许多变化,看起来都没有涉及与 nokogiri 相关的宝石)。
  • 当我运行 bundle install 时,我得到如下输出:Fetching rake 12.0.0, Installing rake 12.0.0, Fetching i18n 0.7.0, Installing i18n 0.7.0, 即使捆绑包遇到错误。您没有得到任何关于正在安装哪些 gem 的输出吗?
  • 一些 gems 是 rails 依赖项(包括 rails-dom-testing)依赖于 nokogiri。见导轨Gemfile.lock

标签: ruby rubygems dependencies bundle


【解决方案1】:

您运行的似乎是旧版本的 bundler (1.9.1),它可能对 ruby​​ 版本控制没有适当的支持。尝试使用新版本运行 gem update bundlerbundle install

【讨论】:

  • 确实,更新捆绑软件后,我得到了不同的信息。现在它告诉我无法安装的是 rdoc 5.1...
  • 我不明白...我再次运行 bundle install (没有 --verbose),它工作。我用 --verbose 再次运行它,不再有问题了。问题解决了,但我不太明白为什么。
【解决方案2】:

因此,问题似乎来自使用旧版本的捆绑程序 (1.9.1)。

使用gem update bundler 将它升级到最新版本将我移动到版本 1.15.2,然后,bundle install 工作(在第二次执行时,但它最终成功了)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-09
    • 2011-08-30
    • 2013-07-25
    相关资源
    最近更新 更多