Home Articles

如何让bundler尊重Ruby版本的子依赖?

Asked
Viewed 1323 times
0

Ruby版本:1.9.3

的Gemfile:

ruby '1.9.3'
   source 'http://rubygems.org'
   gem 'site_prism', '2.6'

运行“捆绑安装”失败:

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

In Gemfile:
 site_prism was resolved to 2.6, which depends on
  capybara was resolved to 2.15.4, which depends on
   xpath was resolved to 2.1.0, which depends on
    nokogiri

nokogiri 1.8.1与Ruby 1.9.3不兼容 .

Why does bundle try to install a gem that isn't compatible with my current Ruby version?

我试过的事情:

  • 不同的捆绑版本(1.12.5,1.15.4,1.16.0)

  • 指定"ruby '1.9.3' in Gemfile"

1 Answer

  • 0

    你将需要指定一个更老版本的nokogiri来实现这一点 . 您可能还必须指定旧版本的capybara或xpath . 尝试放入你的Gemfile

    gem 'nokogiri', '1.6.8'

    并从那里工作 .

Related