'On Ruby: uninitialized constant Nokogiri::ClassResolver (NameError)
I've this issue currently when launching my .rb, that says 1: from /var/lib/gems/2.7.0/gems/nokogiri-1.13.1-x86_64-linux/lib/nokogiri/xml/node.rb:56:in `<module:XML>' /var/lib/gems/2.7.0/gems/nokogiri-1.13.1-x86_64-linux/lib/nokogiri/xml/node.rb:59:in `<class:Node>': uninitialized constant Nokogiri::ClassResolver (NameError)
I've put theses lines in my .rb :
require 'rubygems'
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('http://www.google.com/search?q=doughnuts'))
puts doc
and my Gemfile contains this :
source 'https://rubygems.org'
ruby '2.7.4'
gem 'rspec'
gem 'nokogiri'
gem 'open-uri'
Does anyone have any idea about the problem or oversight that is causing this error?
Thanks!
Solution 1:[1]
The "nokogiri" package updates version might have bugs so try to install lower version of nokogiri package after removes the new version....Try this,
I am not sure about it, I have read it in one senior developer post.
Solution 2:[2]
The following fixed it for me:
sudo apt-get remove ruby-nokogiri
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | che |
| Solution 2 | Sam Ruby |
