octopress / paginate

A simple paginator for Jekyll sites.
MIT License
105 stars 37 forks source link

Error: no implicit conversion of nil into String #18

Closed Frozenfire92 closed 8 years ago

Frozenfire92 commented 8 years ago

When switching from jekyll-paginate to octopress so I can paginate collections I get the following error

Configuration file: /home/.../website/_config.yml
       Deprecation: You appear to have pagination turned on, but you haven't included the `jekyll-paginate` gem. Ensure you have `gems: [jekyll-paginate]` in your configuration file.
            Source: /home/.../website
       Destination: /home/.../website/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Deprecation: Collection#reverse should be called on the #docs array directly.
                    Called by /var/lib/gems/2.1.0/gems/octopress-paginate-1.1.2/lib/octopress-paginate.rb:136:in `collection'.
  Liquid Exception: no implicit conversion of nil into String in _tutorials/2016-01-10-welcome-to-jekyll.markdown
jekyll 3.0.1 | Error:  no implicit conversion of nil into String

Here is my config file

# Blog settings
permalink: /blog/:year/:month/:day/:title
paginate: 6
paginate_path: "/blog/page/:num"

# Tutorial settings
collections:
  - tutorials

# Plugins
gems:
- octopress-paginate

Here is my tutorials index file tutorials/index.html


---
layout: page
nav_layout: tutorial
title: Tutorial Index
paginate:
  collection: tutorials
  permalink: /tutorials/:year/:month/:day/:title

---
{% for tutorial in paginator.tutorials %}
        ...
{% endfor %}

Then I have markdown files in the folder _tutorials

I think this is related to https://github.com/jekyll/jekyll/issues/3929 and https://github.com/octopress/hooks/issues/13

Maybe relevant info

Ubuntu 15.10
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
jekyll 3.0.1
whatsma commented 8 years ago

Yeah, I have a very similar issue with the "no implicit conversion of nil into String (TypeError)" (although I don't get the "Deprecation: Collection#reverse should be called on the #docs array directly." bit).

I was having this problem with my jekyll site and tried to narrow it down by stripping everything out bit by bit. I got down to stripping everything out and it was still there.

Turns this was nothing to do with my site, but happens with a fresh, brand new install of jekyll with the octopress-paginate gem specified in the Gemfile.

Here are the steps I took to create reproduce the issue:

mkdir test
cd test
bundle init
echo "gem 'jekyll'" >> Gemfile
echo "group :jekyll_plugins do" >> Gemfile
echo "  gem 'octopress-paginate'" >> Gemfile
echo "end" >> Gemfile
bundle install
bundle exec jekyll new site
bundle exec jekyll build -s site --trace

Here is the jekyll output when using ruby2.3 on Ubuntu Trusty LTS:

New jekyll site installed in /home/vagrant/2.3/test/site. 
Configuration file: site/_config.yml
            Source: site
       Destination: /home/vagrant/2.3/test/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
  Liquid Exception: no implicit conversion of nil into String in _posts/2016-01-14-welcome-to-jekyll.markdown
/home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll.rb:156:in `expand_path': no implicit conversion of nil into String (TypeError)
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll.rb:156:in `sanitized_path'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:376:in `block in in_source_dir'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:375:in `each'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:375:in `reduce'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:375:in `in_source_dir'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/liquid_renderer.rb:16:in `file'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/renderer.rb:105:in `render_liquid'
    from /home/vagrant/.gem/ruby/2.3.0/gems/octopress-hooks-2.6.1/lib/octopress-hooks.rb:313:in `render_liquid'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/renderer.rb:60:in `run'
    from /home/vagrant/.gem/ruby/2.3.0/gems/octopress-hooks-2.6.1/lib/octopress-hooks.rb:306:in `run'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/excerpt.rb:76:in `output'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/excerpt.rb:60:in `to_s'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/document.rb:367:in `to_liquid'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/renderer.rb:37:in `run'
    from /home/vagrant/.gem/ruby/2.3.0/gems/octopress-hooks-2.6.1/lib/octopress-hooks.rb:306:in `run'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:171:in `block (2 levels) in render'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:169:in `each'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:169:in `block in render'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:168:in `each'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:168:in `render'
    from /home/vagrant/.gem/ruby/2.3.0/gems/octopress-hooks-2.6.1/lib/octopress-hooks.rb:197:in `render'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:59:in `process'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/command.rb:28:in `process_site'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/commands/build.rb:60:in `build'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/commands/build.rb:35:in `process'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
    from /home/vagrant/.gem/ruby/2.3.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from /home/vagrant/.gem/ruby/2.3.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from /home/vagrant/.gem/ruby/2.3.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from /home/vagrant/.gem/ruby/2.3.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from /home/vagrant/.gem/ruby/2.3.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from /home/vagrant/.gem/ruby/2.3.0/gems/jekyll-3.0.1/bin/jekyll:17:in `<top (required)>'
    from /home/vagrant/.gem/ruby/2.3.0/bin/jekyll:23:in `load'
    from /home/vagrant/.gem/ruby/2.3.0/bin/jekyll:23:in `<main>'

Here's my Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    colorator (0.1)
    ffi (1.9.10)
    jekyll (3.0.1)
      colorator (~> 0.1)
      jekyll-sass-converter (~> 1.0)
      jekyll-watch (~> 1.1)
      kramdown (~> 1.3)
      liquid (~> 3.0)
      mercenary (~> 0.3.3)
      rouge (~> 1.7)
      safe_yaml (~> 1.0)
    jekyll-sass-converter (1.4.0)
      sass (~> 3.4)
    jekyll-watch (1.3.0)
      listen (~> 3.0)
    kramdown (1.9.0)
    liquid (3.0.6)
    listen (3.0.5)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
    mercenary (0.3.5)
    octopress-hooks (2.6.1)
      jekyll (>= 2.0)
    octopress-paginate (1.1.2)
      octopress-hooks
    rb-fsevent (0.9.7)
    rb-inotify (0.9.5)
      ffi (>= 0.5.0)
    rouge (1.10.1)
    safe_yaml (1.0.4)
    sass (3.4.21)

PLATFORMS
  ruby

DEPENDENCIES
  jekyll
  octopress-paginate

BUNDLED WITH
   1.11.2                                    

Note, I have tried this out in the following configurations with the same result:

Heres is the vagrant file I used to test this on Ubuntu Trusty LTS: https://gist.github.com/whatsma/5fc072db64c87c4907a6 for reference.

domenic commented 8 years ago

This appears to be related to https://github.com/octopress/hooks/pull/14; I am hoping a fresh release of octopress-hooks with that fix included will also fix the issue.

japilo commented 8 years ago

I am still having this exact same issue with a fresh install of jekyll and octopress, for what it's worth.

Liquid Exception: no implicit conversion of nil into String in _posts/2014-05-14-example-post.md
/usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll.rb:156:in `expand_path': no implicit conversion of nil into String (TypeError)
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll.rb:156:in `sanitized_path'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:355:in `block in in_source_dir'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:354:in `each'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:354:in `reduce'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:354:in `in_source_dir'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/liquid_renderer.rb:16:in `file'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/renderer.rb:106:in `render_liquid'
    from /usr/local/lib/ruby/gems/2.2.0/gems/octopress-hooks-2.6.1/lib/octopress-hooks.rb:311:in `render_liquid'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/renderer.rb:61:in `run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/octopress-hooks-2.6.1/lib/octopress-hooks.rb:306:in `run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:171:in `block (2 levels) in render'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:169:in `each'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:169:in `block in render'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:168:in `each'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:168:in `render'
    from /usr/local/lib/ruby/gems/2.2.0/gems/octopress-hooks-2.6.1/lib/octopress-hooks.rb:197:in `render'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/site.rb:59:in `process'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/command.rb:26:in `process_site'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/commands/build.rb:60:in `build'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/commands/build.rb:33:in `process'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/lib/jekyll/commands/serve.rb:34:in `block (2 levels) in init_with_program'
    from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
    from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.1.1/bin/jekyll:13:in `<top (required)>'
    from /usr/local/bin/jekyll:23:in `load'
    from /usr/local/bin/jekyll:23:in `<main>'
tdeedlesATX commented 8 years ago

I pulled lib from octpopress-hooks https://github.com/octopress/hooks/commit/9ec9efcbe8e2aa4d79d2a35543a29b51f3e6feb2

and issue no longer occurs on jekyll build. Thanks@parkr !

XhmikosR commented 8 years ago

@parkr: this must be the same issue as #19