2017-09-26 26 views
0

我將Ruby從2.3升級到2.4。當我運行包,我得到如何在Ruby 2.4和Nokogiri 1.8.1上使用Rails 5.0.6在Windows上工作?

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) 

然而,bundlerails -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

錯誤是'寶石:: InstallError:引入nokogiri要求Ruby版本< 2.4, > = 2.1.0'。嘗試解鎖'nested_form_fields'的版本,看看這是否使nokogiri解決了一個版本,支持紅寶石2.4 – nicooga

+0

嗯,這不是我的項目。這是它的['Gemfile'](https://github.com/ncri/nested_form_fields/blob/master/Gemfile)和['nested_form_fields.gemspec'](https://github.com/ncri/nested_form_fields/blob/主/ nested_form_fields.gemspec)。它實際上指定'nokogiri','1.6.8.1'。 – Chloe

回答

0

我不知道如何來證明這一點,因爲引入nokogiri團隊沒有釋放gemspec,但引入nokogiri該版本可能不支持紅寶石2.4在Windows上。

看一看: https://github.com/sparklemotion/nokogiri/blob/v1.7.1/.cross_rubies。 IT不包括紅寶石2.4.x.

如果您確實需要升級到2.4紅寶石嘗試鎖定引入nokogiri版本1.8.1上,這似乎支持紅寶石2.4在Windows上按https://github.com/sparklemotion/nokogiri/blob/v1.8.1/.cross_rubies

gem 'nokogiri', '1.8.1' 
+0

你如何改變'nested_form_fields'依賴?你爲什麼認爲這取決於1.7.0.1? – Chloe

+0

對不起,我的假設是不正確的,因爲nested_form_fields將nokogiri指定爲開發依賴項,而不是運行時依賴項。不過我認爲nokogiri 1.7.1不支持windows上的ruby 2.4,所以你需要強制使用nokogiri 1.8.1。更新了答案。 – nicooga

相關問題