sverrirs / jekyll-paginate-v2

Pagination Generator for Jekyll 3 (enhanced replacement for the old built-in jekyll-paginate gem) โ›บ

Home Page:https://rubygems.org/gems/jekyll-paginate-v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pagination for collection and dir_s_mkdir error

baszczewski opened this issue ยท comments

I am using this plugin in newest version: 2.1.0. Unfortunately after jekyll serve I've got error:

jekyll 3.8.5 | Error:  File exists @ dir_s_mkdir - /media/data/projects/test/_site/freebies/index.html

Important part of my _config.yml:

plugins:
  - jekyll-paginate-v2

collections:
  freebies:
    output: true
    permalink: /freebies/:path/

pagination:
  enabled: true
  permalink: '/page/:num/'
  sort_reverse: true
  per_page: 3
  trail: 
    before: 2
    after: 2

autopages:
  enabled: true
  collections:
    enabled: true
    title: 'Posts in collection :coll' # :coll is replaced by the collection name
    permalink: '/:coll'

defaults:
  - scope:
      path: ""
      type: "freebies"
    values:
      layout: "freebies-post"

My freebies posts are located in "_freebies" directory (I've got 4 files here - only markdowns). I don't have in my project file described in error log like: "freebies/index.html".

What is weird here is that structure work's until option pagination->per_page is bigger than count of files inside my collection.

Do you have any idea what I can do here?

@baszczewski Hi, can you post the backtrace generated by running bundle exec jekyll build --trace
Thanks.

Shure @ashmaroli:

Configuration file: /media/data/projects/test/_config.yml
            Source: /media/data/projects/test
       Destination: /media/data/projects/test/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
         AutoPages: Generating tags pages
         AutoPages: Generating categories pages
         AutoPages: Generating collections pages
                    
        Pagination: Complete, processed 1 pagination page(s)
Traceback (most recent call last):
	27: from /usr/local/bin/jekyll:23:in `<main>'
	26: from /usr/local/bin/jekyll:23:in `load'
	25: from /usr/local/share/gems/gems/jekyll-3.8.5/exe/jekyll:15:in `<top (required)>'
	24: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	23: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	22: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	21: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	20: from /usr/local/share/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	19: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
	18: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/commands/build.rb:36:in `process'
	17: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/commands/build.rb:65:in `build'
	16: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/command.rb:28:in `process_site'
	15: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:73:in `process'
	14: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:208:in `write'
	13: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:330:in `each_site_file'
	12: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:330:in `each'
	11: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:331:in `block in each_site_file'
	10: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:331:in `each'
	 9: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:332:in `block (2 levels) in each_site_file'
	 8: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/site.rb:209:in `block in write'
	 7: from /usr/local/share/gems/gems/jekyll-3.8.5/lib/jekyll/convertible.rb:226:in `write'
	 6: from /usr/share/ruby/fileutils.rb:193:in `mkdir_p'
	 5: from /usr/share/ruby/fileutils.rb:193:in `each'
	 4: from /usr/share/ruby/fileutils.rb:208:in `block in mkdir_p'
	 3: from /usr/share/ruby/fileutils.rb:208:in `reverse_each'
	 2: from /usr/share/ruby/fileutils.rb:210:in `block (2 levels) in mkdir_p'
	 1: from /usr/share/ruby/fileutils.rb:232:in `fu_mkdir'
/usr/share/ruby/fileutils.rb:232:in `mkdir': File exists @ dir_s_mkdir - /media/data/projects/test/_site/freebies/index.html (Errno::EEXIST)

Okay, can you check if the error is reproducible with v2.0.0 of this plugin..? I don't see a trace pointing
to jekyll-paginate-v2..

@ashmaroli
That's right. The problem is probably inside v2.1.0. Downgrade resolve this issue.

Pagination: Complete, processed 6 pagination page(s)
jekyll 3.8.5 | Error:  File exists @ dir_s_mkdir - /Users/thomasvaeth/barber-jekyll/_site/tag/squid/index.html

Just wanted to say that I got the same error. Pagination was set at 6 posts per page, but I had 12 posts. Downgrading to v2.0.0 worked for me.

Same problem over here, downgrading to v2.0.0 is the current workaround o/

EDIT : Incredible plugin, mostly the autopage feature. Thanks ๐Ÿ™‡โ€โ™‚๏ธ ๐Ÿ‘‹

I just pulled @ashmaroli's PR as a patch into a branch off master and can confirm that it fixes this issue.

I am running Jekyll 4 (and thus master since I need e3cc120 from 10 days ago), so downgrading isn't an option.

Could you please upgrade to https://rubygems.org/gems/jekyll-paginate-v2/versions/3.0.0 and test again for me?

Works like a charm for me, thanks @sverrirs ๐Ÿ‘Œ ๐Ÿ’ฏ

The problem seems to happened again with the error message:
mkdir': File exists @ dir_s_mkdir

jekyll-3.9.2 and ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux-musl]