Как установить Nokogiri на Ruby 2.7.0 - PullRequest
2 голосов
/ 12 марта 2020

Я недавно обновился до Ruby v2.7.0.

Когда я попытался установить Nokogiri, я получил следующую ошибку:

ERROR:  Error installing nokogiri:
        The last version of nokogiri (>= 0) to support your Ruby & RubyGems was
1.10.9. Try installing it with `gem install nokogiri -v 1.10.9`
        nokogiri requires Ruby version >= 2.3, < 2.7.dev. The current ruby versi
on is 2.7.0.0.

Я пытался установить этот камень с

gem install nokogiri -v 1.10.9

но я получил ту же ошибку.

Как я могу установить Nokogiri сейчас, когда я использую Ruby v2.7.0? Нужно ли устанавливать более раннюю версию Ruby?

Результаты gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 3.1.2
  - RUBY VERSION: 2.7.0 (2019-12-25 patchlevel 0) [x64-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby27-x64/lib/ruby/gems/2.7.0
  - USER INSTALLATION DIRECTORY: C:/Users/gritz/.gem/ruby/2.7.0
  - RUBY EXECUTABLE: C:/Ruby27-x64/bin/ruby.exe
  - GIT EXECUTABLE: C:\Program Files\Git\cmd/git.EXE
  - EXECUTABLE DIRECTORY: C:/Ruby27-x64/bin
  - SPEC CACHE DIRECTORY: C:/Users/gritz/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x64-mingw32
  - GEM PATHS:
     - C:/Ruby27-x64/lib/ruby/gems/2.7.0
     - C:/Users/gritz/.gem/ruby/2.7.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - C:\windows\system32
     - C:\windows
     - C:\windows\System32\Wbem
     - C:\windows\System32\WindowsPowerShell\v1.0\
     - C:\windows\System32\OpenSSH\
     - C:\Program Files\Intel\WiFi\bin\
     - C:\Program Files\Common Files\Intel\WirelessCommon\
     - C:\Program Files\erl10.3\bin
     - C:\Program Files (x86)\Elixir\bin
     - C:\Users\gritz\.mix\escripts
     - C:\Program Files\Git\cmd
     - C:\Users\gritz\.rbenv-win\bin
     - C:\Users\gritz\.rbenv-win\shims
     - C:\Users\gritz\.rbenv-win\bin
     - C:\Users\gritz\.rbenv-win\shims
     - C:\Users\gritz\.rbenv-win\bin
     - C:\Users\gritz\.rbenv-win\shims
     - _SZ    C:\Ruby26\bin
     - C:\Ruby27-x64\bin
     - C:\Ruby26-x64\bin
     - %USERPROFILE%\AppData\Local\Microsoft\WindowsApps

В ответ на один из комментариев я добавляю результаты gem спецификация -r nokogiri:

-r nokogiri
--- !ruby/object:Gem::Specification
name: nokogiri
version: !ruby/object:Gem::Version
  version: 1.10.9
platform: ruby
authors:
- Aaron Patterson
- Mike Dalessio
- Yoko Harada
- Tim Elliott
- Akinori MUSHA
- John Shahid
- Lars Kanis
autorequire:
bindir: bin
cert_chain: []
date: 2020-03-01 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
  name: mini_portile2
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 2.4.0
  type: :runtime
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 2.4.0
- !ruby/object:Gem::Dependency
  name: concourse
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '0.24'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '0.24'
- !ruby/object:Gem::Dependency
  name: hoe-bundler
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '1.2'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '1.2'
- !ruby/object:Gem::Dependency
  name: hoe-debugging
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '2.0'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '2.0'
- !ruby/object:Gem::Dependency
  name: hoe-gemspec
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '1.0'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '1.0'
- !ruby/object:Gem::Dependency
  name: hoe-git
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '1.6'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '1.6'
- !ruby/object:Gem::Dependency
  name: minitest
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '5.8'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '5.8'
- !ruby/object:Gem::Dependency
  name: racc
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 1.4.14
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 1.4.14
- !ruby/object:Gem::Dependency
  name: rake
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '12.0'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '12.0'
- !ruby/object:Gem::Dependency
  name: rake-compiler
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 1.1.0
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 1.1.0
- !ruby/object:Gem::Dependency
  name: rake-compiler-dock
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 0.7.0
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 0.7.0
- !ruby/object:Gem::Dependency
  name: rexical
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 1.0.5
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: 1.0.5
- !ruby/object:Gem::Dependency
  name: rubocop
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '0.73'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '0.73'
- !ruby/object:Gem::Dependency
  name: simplecov
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '0.16'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '0.16'
- !ruby/object:Gem::Dependency
  name: rdoc
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - ">="
      - !ruby/object:Gem::Version
        version: '4.0'
    - - "<"
      - !ruby/object:Gem::Version
        version: '7'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - ">="
      - !ruby/object:Gem::Version
        version: '4.0'
    - - "<"
      - !ruby/object:Gem::Version
        version: '7'
- !ruby/object:Gem::Dependency
  name: hoe
  requirement: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '3.22'
  type: :development
  prerelease: false
  version_requirements: !ruby/object:Gem::Requirement
    requirements:
    - - "~>"
      - !ruby/object:Gem::Version
        version: '3.22'
description: |-
  Nokogiri (?) is an HTML, XML, SAX, and Reader parser.  Among
  Nokogiri's many features is the ability to search documents via XPath
  or CSS3 selectors.
email:
- aaronp@rubyforge.org
- mike.dalessio@gmail.com
- yokolet@gmail.com
- tle@holymonkey.com
- knu@idaemons.org
- jvshahid@gmail.com
- lars@greiz-reinsdorf.de
executables: []
extensions: []
extra_rdoc_files: []
files: []
homepage: https://nokogiri.org
licenses: []
metadata:
  homepage_uri: https://nokogiri.org
  bug_tracker_uri: https://github.com/sparklemotion/nokogiri/issues
  documentation_uri: https://nokogiri.org/rdoc/index.html
  changelog_uri: https://nokogiri.org/CHANGELOG.html
  source_code_uri: https://github.com/sparklemotion/nokogiri
post_install_message:
rdoc_options: []
require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
  requirements:
  - - ">="
    - !ruby/object:Gem::Version
      version: 2.3.0
required_rubygems_version: !ruby/object:Gem::Requirement
  requirements:
  - - ">="
    - !ruby/object:Gem::Version
      version: '0'
requirements: []
rubygems_version: 3.1.2
signing_key:
specification_version: 4
summary: Nokogiri (?) is an HTML, XML, SAX, and Reader parser
test_files: []

1 Ответ

1 голос
/ 16 марта 2020

Если вы используете Ruby + DevKit, попробуйте эту команду:

gem install nokogiri --platform=ruby

Он должен установить nokogiri и привести его в соответствие с вашей версией Ruby. В случае повторного сбоя или извлечения и установки gem, сначала запустите эту команду:

ridk exec pacman -S mingw-w64-x86_64-libxslt

Затем эту команду:

gem install nokogiri --platform=ruby -- --use-system-libraries

Nokogori должен быть установлен после этих команд.

...