Can't run jekyll (undefined method `delegate_method_as')

I’m in a bit of a bind. I decided to switch hosting methods for my site, so needed to migrate my jekyll install. I was just using an AWS machine, but now I’m using GitHub and Netlify. Problem is, if I want to get rid of my AWS machine, I have to get jekyll working on my Debian (Buster) box at home now. I cloned my repo to my local machine, installed all the jekyll dependencies, installed jekyll, cd into the site directory and try to serve the site, and I get the following error:

[various things...]
/var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll/drops/collection_drop.rb:10:in `<class:CollectionDrop>': undefined method `delegate_method_as' for Jekyll::Drops::CollectionDrop:Class (NoMethodError)
Did you mean?  DelegateClass

In fact, I get that error every time I run jekyll in any fashion. Even ‘jekyll --version’. I’ve tried uninstalling and reinstalling it. I made sure I’m on the right version of Ruby (2.5.5). I’m fairly new at the whole jekyll/ruby infrastructure, so I’m kinda lost here. Any idea what’s going wrong? I’d appreciate any help you can offer. Thanks.

is there anything above where you say [various things…] sometimes those can help.

is your repo public? can you share it?

most common thing I have seen cause errors is people sometimes have ruby installed more than once and the different gems can sometimes be spread out instead of all in the same one. You can see this when people post the entire log contents, the path will be a mix of different locations where ruby is installed.

It wasn’t before, but I’ve just made it so.

Here’s the output for just running ‘jekyll --version’. It’s slightly different depending on what you’re doing, but always gets to the same place.

Traceback (most recent call last):
        14: from /usr/local/bin/jekyll:23:in `<main>'
        13: from /usr/local/bin/jekyll:23:in `load'
        12: from /var/lib/gems/2.5.0/gems/jekyll-4.2.0/exe/jekyll:8:in `<top (required)>'
        11: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        10: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
         9: from /var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll.rb:191:in `<top (required)>'
         8: from /var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll.rb:12:in `require_all'
         7: from /var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll.rb:12:in `each'
         6: from /var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll.rb:13:in `block in require_all'
         5: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
         4: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
         3: from /var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll/drops/collection_drop.rb:3:in `<top (required)>'
         2: from /var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll/drops/collection_drop.rb:4:in `<module:Jekyll>'
         1: from /var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll/drops/collection_drop.rb:5:in `<module:Drops>'
/var/lib/gems/2.5.0/gems/jekyll-4.2.0/lib/jekyll/drops/collection_drop.rb:10:in `<class:CollectionDrop>': undefined method `delegate_method_as' for Jekyll::Drops::CollectionDrop:Class (NoMethodError)
Did you mean?  DelegateClass

so I am not a nix user, so I am not familiar with the paths.

To me it looks like you may have jekyll installed in both user/local/bin and var/lib/gems. I would go poke around in both of those locations and see what is there. If the same things is in both locations then it could be that it is confused and trying to run half the command in one place, the other half in another.

But again I am not at all familiar with your OS. Fairly sure on windows I would not have jekyll in 2 different paths.

How did you install jekyll?

Certainly sounds plausible. I installed jekyll from the command line ‘gem install jekyll’. I’ll check it out tomorrow morning. Thank you!

That was it. I must have installed jekyll from apt without thinking then again later with gem. Thanks so much!

Just a thought. If you’re on GitHub, why not use GitHub pages to deploy your site. It would just take all the technical nix admin out of your hands and let you get on with it. :man_shrugging:t2:

1 Like

I wanted to be able to use my own domain. I’m serving it up via Netlify.

I’m not trying to be stupid here, but I host a work website from GitHub pages, using a custom domain, so it’s more than possible. It might simplify your devops experience here and let you get on with creating content, not worrying about nix admin and paying for additional hosting. Anyway - over to you.

Oh sorry. I didn’t realize that was an option. Certainly didn’t mean to imply you were being stupid. I kind of enjoy fussing around in Linux, so that’s almost a point in my current solution’s favor. And at the traffic levels I’m expecting, I won’t need to go past Netlify’s free tier.

1 Like

Ah - no probs at all. My bad for pushing a solution you weren’t looking to solve. Didn’t realise you wanted that extra layer. Enjoy.