我正在尝试将Nokogiri升级到版本1.7:
gem 'nokogiri', '~> 1.7'
但是当我跑步时:
bundle update --source nokogiri
我明白了:
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.............
Bundler could not find compatible versions for gem "nokogiri":
这是我的Gemfile:
nokogiri (~> 1.7)
activemerchant (~> 1.58.0) was resolved to 1.58.0, which depends on
nokogiri (~> 1.4)
activemerchant (~> 1.58.0) was resolved to 1.58.0, which depends on
nokogiri (~> 1.4)
capybara was resolved to 2.7.0, which depends on
nokogiri (>= 1.3.3)
cucumber-rails was resolved to 1.4.3, which depends on
nokogiri (~> 1.5)
haml-rails was resolved to 0.9.0, which depends on
html2haml (>= 1.0.1) was resolved to 2.0.0, which depends on
nokogiri (~> 1.6.0)
haml-rails was resolved to 0.9.0, which depends on
html2haml (>= 1.0.1) was resolved to 2.0.0, which depends on
nokogiri (~> 1.6.0)
rails (>= 4.2.6, ~> 4.2) was resolved to 4.2.6, which depends on
actionmailer (= 4.2.6) was resolved to 4.2.6, which depends on
actionview (= 4.2.6) was resolved to 4.2.6, which depends on
rails-html-sanitizer (>= 1.0.2, ~> 1.0) was resolved to 1.0.3, which depends on
loofah (~> 2.0) was resolved to 2.0.3, which depends on
nokogiri (>= 1.5.9)
roo (~> 2.4.0) was resolved to 2.4.0, which depends on
nokogiri (~> 1)
roo-xls was resolved to 1.0.0, which depends on
nokogiri
capybara was resolved to 2.7.0, which depends on
xpath (~> 2.0) was resolved to 2.0.0, which depends on
nokogiri (~> 1.3)
有没有人知道它为什么找不到它?我在rubygems.org上看到当前版本是1.7.1以及github。我是否需要指定github源?
答案 0 :(得分:2)
问题在于:
haml-rails was resolved to 0.9.0, which depends on
html2haml (>= 1.0.1) was resolved to 2.0.0, which depends on
nokogiri (~> 1.6.0)
如您所见,html2haml
取决于nokogiri (~> 1.6.0)
,即不 1.7
。您需要更新html2haml
(因此相关性变为nokogiri (~> 1.6)
)或使用nokogiri, ~> 1.6
。
您可以尝试删除Gemfile.lock
文件并再次运行bundle install
,但我建议您在尚未投入使用时进行此操作。
答案 1 :(得分:1)
我认为其他宝石依赖于Nokogiri,所以
试试bundle update
。
bundle update
将解析依赖关系树并尝试安装满足所有其他gem依赖关系的版本。