1

每个人。我正在使用这个 ruby​​ 脚本将我的 Blogger XML 文件导入 Octopress。初始导入工作正常,解析 XML 并生成 HTML 文件./_posts/(使用正确的命名约定)。我把这些移到了./source/_posts/Jekyll 可以解析它们以便在站点中使用。当我尝试使用rake -t generate时,我收到此错误:

samurailink3@Manacotti:~/Dropbox/Important Backups/Git Repos/samurailink3.com$ rake -t generate
** Invoke generate (first_time)
** Execute generate
## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/_config.yml
Building site: source -> public
/usr/lib/ruby/1.9.1/uri/common.rb:304:in `escape': undefined method `gsub' for 3:Fixnum (NoMethodError)
    from /usr/lib/ruby/1.9.1/uri/common.rb:623:in `escape'
    from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/post.rb:140:in `block in url'
    from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/post.rb:140:in `map'
    from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/post.rb:140:in `url'
    from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:69:in `location_on_server'
    from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:219:in `fill_location'
    from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:181:in `fill_url'
    from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:146:in `block in fill_posts'
    from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:144:in `each'
    from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:144:in `fill_posts'
    from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:120:in `generate'
    from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:190:in `block in generate'
    from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `each'
    from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `generate'
    from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:40:in `process'
    from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
    from /usr/local/bin/jekyll:23:in `load'
    from /usr/local/bin/jekyll:23:in `<main>'

有任何想法吗?在我尝试导入之前,一切都运行良好。

另外,如果您想看一下,这里是代码。我在source分支机构工作。

4

1 回答 1

2

我希望这些类型的错误在进行自动翻译时很常见,并且每次都有自己的技巧和转折。当我导入 jekyll 时,它被未关闭的 iframe HTML 标签(用于嵌入视频)阻塞。即使它们是有效的,解析器也不喜欢它们。你可能有类似的事情发生。

这一行:

/usr/lib/ruby/1.9.1/uri/common.rb:304:in `escape': undefined method `gsub' for 3:Fixnum (NoMethodError)

为您提供从哪里开始的第一条线索。有东西试图调用“gsub”。我的第一步是在输出文件中搜索该字符串。如果找到了,请暂时删除 ./source/_posts/ 目录中除此之外的所有其他文件。这将减少您的问题集的大小,并让您进行更多实验以弄清楚到底发生了什么。开始破解该文件,直到你让它工作。

Update: If you don't find 'gsub' (and I've seen a few more references to it that make me think you won't find that as a string). A good trouble shooting approach is still to only keep one file at a time in your ./source/_posts/ directory to narrow down exactly what is going on.

于 2013-02-01T14:56:18.787 回答