Cannot load such a file - libxml_ruby for Windows

My step

  • Run RubyInstaller.exe file
  • install ruby
  • Installed Path: c: \ ruby193
  • install devkit
  • gem install libxml-ruby --platform x86-mswin32-60
  • make test.rb file

    rubygems required
    require 'xml'

  • ruby test.rb

  • msg print error

Error message:

C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 126: The specified module could not be found - C:/Ruby193/lib/ruby/gems/1.9.1/gems/lib xml-ruby-1.1.3-x86-mswin32-60/lib/libxml_ruby.so (LoadError) from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libxml-ruby-1.1.3-x86-mswin32-6 0/lib/libxml.rb:9:in `<top (required)>' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libxml-ruby-1.1.3-x86-mswin32-6 0/lib/xml.rb:11:in `<top (required)>' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require' from test.rb:2:in `<main>' 

I want a solution to this problem plz. help me.

+4
source share
1 answer

There was a similar problem on Windows 7x64 with libxml-ruby 2.3.3 (Ruby 2, 1.9.3, and 1.9.2). In accordance with this decision:

https://github.com/xml4r/libxml-ruby/issues/42#issuecomment-7040881

I managed to solve my problem. Solution (thanks to the original author):

  • Find "libxml.rb" in the folder with the libxml-ruby folder (something like "C: \ Ruby \ Ruby192 \ lib \ ruby ​​\ gems \ 1.9.1 \ gems \ libxml-ruby-2.3.3-x86- mingw32 \ lib ')
  • Add the following above the file:

    ENV ['PATH'] = ENV ['PATH'] + ';' + File.expand_path (File.dirname (__ FILE__) + '/ libs')

  • Save and enjoy

+7
source

Source: https://habr.com/ru/post/1447234/


All Articles