4

我的步骤是,

  1. 执行 RubyInstaller.exe 文件
  2. 安装红宝石
  3. 安装路径:c:\ruby193
  4. 安装 DevKit
  5. 宝石安装 libxml-ruby --platform x86-mswin32-60
  6. 制作 test.rb 文件

    需要'rubygems'
    需要'xml'

  7. 红宝石测试.rb

  8. 打印错误信息

错误信息:

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>'

我想解决这个问题。帮我。

4

1 回答 1

7

在带有 libxml-ruby 2.3.3(Ruby 2、1.9.3 和 1.9.2)的 Windows 7x64 上存在类似问题。根据此解决方案:

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

我管理我的问题也解决了。解决方案(感谢原作者):

  1. 在 libxml-ruby gem 文件夹中找到“libxml.rb”(类似于“C:\Ruby\Ruby192\lib\ruby\gems\1.9.1\gems\libxml-ruby-2.3.3-x86-mingw32\lib”)
  2. 在文件顶部添加以下内容:

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

  3. 保存并享受

于 2013-05-28T09:27:30.410 回答