Jekyll upgrade 3.8.7 -> 4.3.1 help. In rbenv, multiple Jekyll versions are installed simultaneously, but old Jekyll prevails

Hello, I’m using Debian 11, and my ruby, bundle, jekyll, et.c comes from having all been installed by rbenv. Not Debian packages.

which ruby


ruby -v

ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]

gem list | grep jekyll

jekyll (4.3.1, 3.8.7)
jekyll-feed (0.17.0)
jekyll-mastodon_webfinger (1.0.2)
jekyll-sass-converter (2.2.0, 1.5.2)
jekyll-seo-tag (2.8.0)
jekyll-watch (2.2.1)

bundle exec jekyll --version

jekyll 3.8.7

So as you can see, Jekyll 4.3.1 is installed, but somehow it isn’t selected for use; 3.8.7 still is.

By what cryptic magic can I tell rbenv or ruby or bundle or jekyll or whatever that I’d like to use Jekyll 4.3.1 now? Does my 3.8.7 just sort of linger forever after that, unused?

My intuition tells me that you want one and only one version of anything installed at once. Multiple versions installed simultaneously seems strange to me.

Hi, i’ve a similar issue. I’m stuck at Jekyll 3.9.2 while v.4.3.1 is also installed.
What would then be a way to trace where the “limiting” factor is?
My guess would be to use the “Gemfile.lock” and check all the packages one by one (see when they were last updated → would then not be compatible with newer Jekyll updates?)
Looking forward for other ways to do the detective work

Have you tried this?

In your Gemfile, replace whatever gem jekyll line you have to:

gem "jekyll", "4.3.1"

After that, run:

bundle install
bundle update

Then check your Jekyll version, like this:

jekyll -v


bundle exec jekyll -v

Hi Bill,
thanks for your input!
yes, if I “force” a “4.3.1” update, it will be installed but I’ve a series of errors when I launch the “serve” command afterwards.
If I don’t specify the jekyll version in the gem file, then the 3.9.2 will be used and it works.
At this stage I need an efficient way to troubleshoot the issue (which package is the bottleneck?)
Thanks again

I would like to know what exactly these errors are.

1 Like

Can you share the errors? Set your gemfile to 4.3.1 and then run bundle exec jekyll serve and share all the results here between a set of three backticks.

Also, if you are using a public repo, could you share that url?

1 Like

Hi Bill & Ashmaroli,

My gemfile looks like that:

gem 'jekyll'
gem 'colorator'
gem 'jekyll-sitemap'
gem 'jekyll-paginate'
gem 'jekyll-tagging'
gem 'kramdown'
gem 'kramdown-parser-gfm'
gem 'jekyll-watch'
gem 'wdm'
gem 'uglifier'
gem 'jekyll-assets'
gem 'jekyll-minimagick'
gem 'mini_magick'
gem 'jekyll-compass'
gem 'jekyll-email-protect'
gem 'jekyll-archives'
gem 'tzinfo'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'webrick'

and the error list

 Incremental build: enabled
      Jekyll 4.3.1   Please append `--trace` to the `serve` command
                     for any additional information or backtrace.
Traceback (most recent call last):
        24: from E:/Dev/Ruby/bin/jekyll:23:in `<main>'
        23: from E:/Dev/Ruby/bin/jekyll:23:in `load'
        22: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/exe/jekyll:15:in `<top (required)>'
        21: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        20: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        19: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        18: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        17: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        16: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
        15: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        14: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `each'
        13: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        12: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/commands/build.rb:36:in `process'
        11: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/commands/build.rb:65:in `build'
        10: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:28:in `process_site'
         9: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:79:in `process'
         8: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:191:in `generate'
         7: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:191:in `each'
         6: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:193:in `block in generate'
         5: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-sitemap-1.4.0/lib/jekyll/jekyll-sitemap.rb:13:in `generate'
         4: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-sitemap-1.4.0/lib/jekyll/jekyll-sitemap.rb:65:in `file_exists?'
         3: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-sitemap-1.4.0/lib/jekyll/jekyll-sitemap.rb:65:in `any?'
         2: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-sitemap-1.4.0/lib/jekyll/jekyll-sitemap.rb:65:in `block in file_exists?'
         1: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/static_file.rb:163:in `url'
E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/static_file.rb:150:in `cleaned_relative_path': undefined method `length' for nil:NilClass (NoMethodError)

Hope you understand more what’s happening than me!
Thanks again for your help

PS: Bill, no there’s no public repository. I’m developing it locally then uploading manually on Google Firebase (“manually” is a big word, I run a command under Node.js).

Hmmm… this might be getting too deep in the weeds without looking at more of the code, so maybe @ashmaroli has some other ideas.

The first thing that comes to mind is the cleaned_relative_path error. Did you set a url and baseurl in your /_config.yml file, like this:

baseurl: "/myblog" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g.
1 Like

From the trace, it is clear to me that the error is due to one of your static files. But there’s no intel on how exactly the cause for this error is arising. I think one of your plugins is at fault.
However, that’s only a speculation since your repository isn’t public.
Are you using any plugins via your _plugins directory? Not that it matters much. But if there is a poorly implemented .rb file within, that could cause unexpected errors.

Regardless, you can give me additional details by pasting the following code into a file at path _plugins/debug_issue.rb (relative to root of your source_dir):

Jekyll::Hooks.register :site, :pre_render do |_site, _payload| { |f| f.extname.nil? }.each do |sf|
    Jekyll.logger.warn "Bad static file:", sf.relative_path.cyan

Note: Remove jekyll-sitemap from your config file prior to running bundle exec jekyll build.
Post the results for further feedback.
Good luck.

1 Like

@ashmaroli @BillRaymond thanks again for staying put on this case (you’ll see in my next post below, I’ve good news…).

As for the “debug_issue.rb”, sadly it didn’t work at all (here I added it on a site that was compiling OK with Jekyll 4.3.1)

Here’s how the build looks like

 Incremental build: disabled. Enable with --incremental
Traceback (most recent call last):
        20: from E:/Dev/Ruby/bin/jekyll:23:in `<main>'
        19: from E:/Dev/Ruby/bin/jekyll:23:in `load'
        18: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/exe/jekyll:15:in `<top (required)>'
        17: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        16: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        15: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        14: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        13: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        12: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
        11: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        10: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `each'
         9: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
         8: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/commands/build.rb:36:in `process'
         7: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/commands/build.rb:65:in `build'
         6: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/command.rb:28:in `process_site'
         5: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:80:in `process'
         4: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:208:in `render'
         3: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/hooks.rb:102:in `trigger'
         2: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/hooks.rb:102:in `each'
         1: from E:/Dev/Ruby/lib/ruby/gems/2.7.0/gems/jekyll-4.3.1/lib/jekyll/hooks.rb:103:in `block in trigger'
E:/Dev/server/wamp/www/bdhq/_plugins/debug_issue.rb:2:in `block in <top (required)>': undefined local variable or method `site' for main:Object (NameError)
Did you mean?  _site

But it’s secondary (at least for me), as I found the solution below.

@BillRaymond @ashmaroli thanks for your continuous support. It gave me the impulse to dig deeper (what I didn’t want to initially - took me 2 hours testing here and there)

  • I set the Gemfile to only use Jekyll v3.9.2 (which was working fine)
  • @BillRaymond you pointed me back to the basics, the _config.yml, so I did a bit of a cleanup in the “plugins” sections.
    It was a bit repetitive, but I did comment one line of a plugin, did build again, “does it still build OK or not?”. If OK, I did cleanup the _site folder, sass cache and jekyll cache, then repeated the operation until I only kept what was needed.
  • @ashmaroli I was sadly not successfull debugging using your .rb file (see above)… But you gave me the idea to really check all the plugins in my _plugins folder.
    Once again, deleting them one by one, “does it still build ok or not?”.
    Until I only had an old “jekyll-minimagick.rb” left (year 2017)
  • At that stage, I had cleaned up my config file and the plugins directory to fit my current needs.
  • I then forced the Jekyll v.4.3.1 in the Gemfile
  • I then updated the “jekyll-minimagick” that has a new December 2022 version compatible with Jekyll 4
  • Had to fix some SASS issues related to formulas in SCSS files (for example, “$leading / $base” needs to be “calc($leading / $base)” ), since I am using Gutenberg (it’s a web typography starter kit)
  • … and it built fine, without any errors :grinning:

:+1: thanks to you both @BillRaymond and @ashmaroli
I started to use Jekyll in 2016 and I’ve been working on this site structure since 2018. Used it, tweaked it, etc, overtime it did gather all kind of crap. I was very frustrated I couldn’t get the “latest” Jekyll because of some mystery issue. There are so many custom things I was always afraid updating Jekyll, in case it breaks…Now this is fixed, thanks to you!

Glad to hear things went well and you are back up and running! #technicaldebtisreal :slight_smile:


Hello @eric-zh,
I noticed a typo in the suggested .rb file after seeing the error report you posted after running it. Sorry abt that. Either ways, I’m glad to know that you have successfully resolved the issue and hopped onto Jekyll 4.
Thank you for sticking with Jekyll over the years.

1 Like