cannot load such file — libxml_ruby for Windows

喜你入骨 提交于 2019-12-21 05:14:27

问题


My step is,

  1. Execute RubyInstaller.exe file
  2. install ruby
  3. installed Path: c:\ruby193
  4. install DevKit
  5. gem install libxml-ruby --platform x86-mswin32-60
  6. make test.rb file

    require 'rubygems'
    require 'xml'

  7. ruby test.rb

  8. print error msg

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 solution in this problem plz. help me.


回答1:


Had similar problem on Windows 7x64 with libxml-ruby 2.3.3 (Ruby 2, 1.9.3 and 1.9.2). As per this solution:

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

I managed my problem was also solved. Solution (thanks to the original author):

  1. Locate 'libxml.rb' in libxml-ruby gem folder (something like 'C:\Ruby\Ruby192\lib\ruby\gems\1.9.1\gems\libxml-ruby-2.3.3-x86-mingw32\lib')
  2. Add the following on top of the file:

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

  3. Save and enjoy



来源:https://stackoverflow.com/questions/13475306/cannot-load-such-file-libxml-ruby-for-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!