jekyll-paginate-v2: Errors trying to write pagination pages with Jekyll v4

Using the Pr #167 which relaxes the Jekyll dependency to allow v4, I’m seeing the following error which crashes the build.

I can see in the verbose --trace that my post tags are all being read correctly before this, but when it tries to write autopages for tags it breaks.

It’s possible it’s something related to the paper-for-ios tag it seems to be failing on since a couple of category paginated pages write fine. But as far as I can tell there’s nothing unique or “wrong” with this tag other than it’s on a lot of posts.

...
Writing: E:/test-repo/_site/mastering-paper/index.html
Writing: E:/test-repo/_site/mastering-paper/page/2/index.html
Writing: E:/test-repo/_site/notes/index.html
Writing: E:/test-repo/_site/notes/page/2/index.html
Writing: E:/test-repo/_site/notes/page/3/index.html
Writing: E:/test-repo/_site/tag/paper-for-ios/index.html
E:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:230:in `mkdir': File exists @ dir_s_mkdir - E:/test-repo/_site/tag/paper-for-ios/index.html (Errno::EEXIST)
        from E:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:230:in `fu_mkdir'
        from E:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:208:in `block (2 levels) in mkdir_p'
        from E:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:206:in `reverse_each'
        from E:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:206:in `block in mkdir_p'
        from E:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:191:in `each'
        from E:/Ruby24-x64/lib/ruby/2.4.0/fileutils.rb:191:in `mkdir_p'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/convertible.rb:225:in `write'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:219:in `block in write'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:344:in `block (2 levels) in each_site_file'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:343:in `each'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:343:in `block in each_site_file'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:342:in `each'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:342:in `each_site_file'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:218:in `write'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:78:in `process'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:28:in `process_site'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:65:in `build'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:36:in `process'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `block in process_with_graceful_fail'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `each'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `process_with_graceful_fail'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/jekyll-4.0.0/exe/jekyll:15:in `<top (required)>'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/bin/jekyll:23:in `load'
        from E:/Ruby24-x64/lib/ruby/gems/2.4.0/bin/jekyll:23:in `<main>'

Will test on macOS to see if it’s a Windows thing when I get a chance.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hello everyone !

@mmistakes’ advises work well, so here is a straightforward way to achieve this technically on your own :

# Remove the Gem previously installed from repositories
gem uninstall jekyll-paginate-v2
gem cleanup

# Download official Jekyll-Paginate-v2 (v2.0.0), and extract it
wget https://github.com/sverrirs/jekyll-paginate-v2/archive/v2.0.0.tar.gz
tar xvzf v2.0.0.tar.gz
cd jekyll-paginate-v2/

Apply @mmistakes’ “patch” (👌) :

diff --git a/jekyll-paginate-v2.gemspec b/jekyll-paginate-v2.gemspec
index 6c5fb8b..5cb933a 100644
--- a/jekyll-paginate-v2.gemspec
+++ b/jekyll-paginate-v2.gemspec
@@ -23,8 +23,7 @@ Gem::Specification.new do |spec|
   spec.require_paths = ["lib"]
 
   # Gem requires Jekyll to work
-  # ~> is the pessimistic operator and is equivalent to '>= 3.0', '< 4.0'
-  spec.add_runtime_dependency "jekyll", "~> 3.0"
+  spec.add_runtime_dependency "jekyll", ">= 3.6", "< 5.0"
 
   # Development requires more
   spec.add_development_dependency "bundler", "~> 1.5"
# Build and install the Gem locally
gem build jekyll-paginate-v2.gemspec
gem install jekyll-paginate-v2 --local

# Cleanup
cd -
rm -rf jekyll-paginate-v2/

# Let's rock !
jekyll <...>

Bye 👋

@hosnas I’d try the fork and see if your site builds. If it does use it. If it doesn’t, don’t wait to upgrade.

# Gemfile
gem 'jekyll-paginate-v2', github: 'mmistakes/jekyll-paginate-v2', :branch => 'jekyll-v4'

You’re not missing much with Jekyll 4 right now other than some nice performance gains.

Yeah, it’s a big complicated mess. Let me do some further testing and push up a smaller repro site since my build workflow uses Gulp to kickoff the Jekyll build.

It seems isolated to autopages.tags. When I disable that module in _config.yml everything builds fine… just with no paginated tag pages.

Repo restored to last known good state with selective cherrypicks, please upgrade to https://rubygems.org/gems/jekyll-paginate-v2/versions/3.0.0

Hi all, been a little busy with life but I will have a look and attempt to revert the repo back to the last known good state and relax the restrictions to enable jekyll 4

@sverrirs Is it feasible to release a v2.0.1 from 2.0.0 code with no changes but the loosened requirement for Jekyll version? I almost forked it on RubyGems only for this change.

@curious-toad You’ll want to downgrade jekyll-paginate-v2 to 2.0.0 and not use the latest release of 2.0.1 as it introduced some sort of defect with the Autopages module. I had this issue with Jekyll v3.

If you want to use Jekyll v4 you can use my fork of the gem, which is pretty much 2.0.0 but with one small change to allow it to support Jekyll v4.

Not sure if Autopages can create index pages for custom taxonomies. I’m pretty sure it only works with site.tags and site.categories. My site is a bit misleading… the works.md page and _work collection isn’t generated or paginated via the plugin. I’m using it to build an index page that combines some collection documents along with work “posts” found in this folder.

These are part of my work category, which is why you might see that in the front matter but it’s not used for Autopages. I’m doing this because tags and categories are only available via the site objects when used on posts… and not collection documents. That might have changed in Jekyll v4 but I’m not sure.

@ashmaroli Does seem that you fixed it in this PR #151