Nokogiri vs SU2018

I tried it. It is very funny.
There is a nokogiri-1.10.10 directory in “c:\Users\Munka\AppData\Roaming\SketchUp\SketchUp 2021\SketchUp\Gems64\gems”
The error message is below

require ‘nokogiri’; Nokogiri::VERSION
Error: #<LoadError: cannot load such file – nokogiri>
C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:92:in require' C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:92:in require’

:in `' SketchUp:in `eval'

Ok. It would be a good idea to clean the current (and incomplete) install. Go to:

c:\Users\Munka\AppData\Roaming\SketchUp\SketchUp 2021\SketchUp\Gems64

And delete any file or directory starting with nokogiri. Once done with that:

Download to anywhere on your PC, then run:

Gem.install '<path to download>'

Once you do that:

require 'nokogiri'; Nokogiri::VERSION

I tried the same procedure with nokogiri-1.10.10-x64-mingw32.gem , and it wouldn’t install, not sure why. You’re welcome to try it, but 1.11.0.rc3 should work fine.

Sorry, I just noticed this. I said to download the most recent x64-mingw32 gem. You used the x86-mingw32 gem, which is a 32 bit gem which won’t work with SketchUp…

Thank you for your help.
Yes I did what you wrote,
nokogiri-1.11.0.rc3-x64-mingw32.gem was installed succesfully.

But it does not solve my original problem. If I try to install any xlsx parser gem such as rubyXL, roo or simple_xlsx_reader all of them install nokogiri-1.10.10 gem first
then terminates because ruby.exe is not found.

What you want to do is creating a ‘perfect storm’ of issues. I could explain them later.

Anyway, when you install whatever, you need to tell RubyGems to ignore dependencies. Without reviewing code, I’m not sure how to do that with Gem.install.

There’s RubyGems utility I wrote at:

You need to download the file, then load it in the SU Ruby console. Then type:

SUGem.install 'rubyXL --ignore-dependencies'

And everything should work. If the gem you use has any dependencies other than Nokogiri, you will also need to install them.

You can also forget about the su_gem.rb file and use:

Gem.install 'rubyXL', nil, {ignore_dependencies: true}

Thank you for your advice.
Now we are a step ahead.
I did exactly what you suggested.
rubyXL was installed without any error however a new issue has arisen, namely a MissingSpecError.
Please find below the ruby console messages
(Please note that xlsdraw-rubyXL.rb is my own ruby script. It requires rubyXL)
Error Loading File xlsDraw-rubyXL.rb
Error: #<Gem::MissingSpecError: Gem::MissingSpecError>
C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/dependency.rb:311:in to_specs' C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/specification.rb:1402:in block in activate_dependencies’
C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/specification.rb:1391:in each' C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/specification.rb:1391:in activate_dependencies’
C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/specification.rb:1373:in activate' C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems.rb:215:in rescue in try_activate’
C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems.rb:208:in try_activate' C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:161:in rescue in require’
C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:156:in require' C:/Users/Munka/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/xlsDraw-rubyXL.rb:4:in <top (required)>’

What is line 4 of xlsDraw-rubyXL.rb? Have you installed rubyzip?

xlsDraw-rubyXL.rb is my own ruby script which is parsing xlsx files.
It is more than 2000 lines of code.
All the require statetments at the beginning
require ‘sketchup.rb’
require ‘MgyMethods.rb’
#require ‘roo’
require ‘rubyXL’
require “win32ole” # just for the send_escape method

There is no more require statement in the whole code.
The very same code is working in SU versions 2018, 2019 and 2020.

rubyzip was installed by me at the beginning of the struggle to install rubyXL. Anyway it is reinstalled every time by rubyXL when just Gem.install ‘rubyXL’ is typed.

The exception object should contain the name and requirement that is failing.

The source code in rubygems/dependency.rb looks like is:

Line: 311        raise name, requirement

Try adding a rescue clause after your ‘require’ statement and inspect the exception to discover the details of the failing dependency.

  require ‘rubyXL’
rescue => exception   
  # class Gem::MissingSpecError has a custom constructor. The fields are accessed through
  # the getter methods name() and requirement()
  puts exception.requirement

You may have to add diagnostic code into the rubygems files on your computer if the exception object isn’t passed back to the user code.

Good Hunting!