Nokogiri 需要 Ruby 版本 < 2.3

Nokogiri requires Ruby version < 2.3

我正在尝试让 Rails 在 Windows 10 上工作。我正在使用 Ruby 2.3.0 和 Rails 4.2.6,并且暂时使用 Nokogiri 1.6.3.

当我尝试 运行ning rails new demo 时,它 returns 出现错误:

An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling.

当我 运行 gem install nokogiri -v '1.6.7.2 我得到:

ERROR:  Error installing nokogiri:
        nokogiri requires Ruby version < 2.3, >= 1.9.2.

如何更新 Nokogiri 并使 Rails 正常工作?

安装最新版本的 Nokogiri。在 Gemfile 中:

gem 'nokogiri', '~> 1.6.8.rc2'

使用bundle update nokogiri,还要检查你的ruby版本ruby -v

我遇到了和你一样的问题。在 Windows 您需要执行额外的步骤:

http://www.nokogiri.org/tutorials/installing_nokogiri.html

我最近 运行 在 windows 上使用 Ruby v2.4.1 安装 rails 时遇到了同样的问题 我发现删除 gemfile 行:

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

然后 运行宁bundle update

然后 将 tzinfo-data 行放回 gemfile

然后我可以 运行 捆绑没有任何问题。一切都恢复正常了。

问题已在 Nokogiri 1.8.0 版本中解决。