我将Ruby从2.3升级到2.4。当我运行bundle时,我得到了
C:\Users\Chloe\workspace>bundle
Fetching gem metadata from https://rubygems.org/.........
Gem::InstallError: nokogiri requires Ruby version < 2.4, >= 2.1.0.
An error occurred while installing nokogiri (1.7.0.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.7.0.1'` succeeds before bundling.
In Gemfile:
nested_form_fields was resolved to 0.8.2, which depends on
rails was resolved to 5.0.2, which depends on
actioncable was resolved to 5.0.2, which depends on
actionpack was resolved to 5.0.2, which depends on
actionview was resolved to 5.0.2, which depends on
rails-dom-testing was resolved to 2.0.2, which depends on
nokogiri
但是,我可以使用gem install rails --version 5.0.6
手动安装Rails。它安装了Nokogiri 1.8.1。 (我也安装了,然后删除了Rails 5.0.2。)
C:\Users\Chloe\workspace>gem list nokogiri
*** LOCAL GEMS ***
nokogiri (1.8.1 x64-mingw32)
但是,bundle
和rails -v
仍然无法正常工作。
C:\Users\Chloe\workspace>rails -v
Could not find nokogiri-1.7.0.1-x64-mingw32 in any of the sources
Run `bundle install` to install missing gems.
Gemfile
gem 'rails', '~> 5.0.2'
ruby '~> 2.4.0'
...
答案 0 :(得分:0)
我不知道如何证明这一点,因为nokogiri团队没有发布gemspec,但是那个版本的nokogiri可能不支持Windows上的ruby 2.4。
看看: https://github.com/sparklemotion/nokogiri/blob/v1.7.1/.cross_rubies。它不包括ruby 2.4.x。
如果你绝对需要升级到ruby 2.4,请尝试在1.8.1上锁定nokogiri版本,这似乎支持windows上的ruby 2.4 https://github.com/sparklemotion/nokogiri/blob/v1.8.1/.cross_rubies
gem 'nokogiri', '1.8.1'