Hpricot版本无法正常工作

时间:2013-09-22 19:17:58

标签: ruby jekyll hpricot

我正在尝试按照以下说明将我的博客迁移到Jekyll:http://jekyllrb.com/docs/migrations/

我的所有帖子都是.xml格式,但转换它们的命令似乎不起作用:

    ruby -rubygems -e 'require "jekyll/jekyll-import/wordpressdotcom";
    JekyllImport::WordpressDotCom.process({ :source => "wordpress.xml" })'
/home/robin/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- hpricot (LoadError)
    from /home/robin/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/robin/.rvm/gems/ruby-1.9.3-p448/gems/jekyll-import-0.1.0.beta3/lib/jekyll/jekyll-import/wordpressdotcom.rb:4:in `'
    from /home/robin/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
    from /home/robin/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
    from /home/robin/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from -e:1:in `'

我想这是因为没有安装Hpricot(gem list没有显示它,即使我用gem install安装它也没有)。它也可能是一个Ruby版本问题(因此多个“from”行ruby -v告诉我它是ruby 1.9.3p448。

非常感谢您的帮助

1 个答案:

答案 0 :(得分:3)

Hpricot的GitHub页面说:

  

Hpricot已经结束。请考虑像nokogiri这样的替代方案。

Hpricot已经很长时间没有维护了(参见GitHub页面) - 您应该将XML解析器更改为Nokogiri或Ox: