carpentries / workshop-template

The Carpentries Workshop Template
https://carpentries.github.io/workshop-template/
Other
235 stars 521 forks source link

`make serve` error: `undefined method 'tainted'?` #781

Closed mtthsdzwn closed 1 year ago

mtthsdzwn commented 1 year ago

I am trying to generate a preview for a Library Carpentry website using make serve. This used to work for previous websites, but now I see an error message. The message is quite long; I think the most relevant part is

Liquid Exception: undefined method `tainted?' for nil:NilClass in $WORKING_DIR/_extras/about.md

jekyll 3.9.2 | Error:  undefined method `tainted?' for nil:NilClass

$WORKING_DIR/.vendor/bundle/ruby/3.2.0/gems/liquid-4.0.3/lib/liquid/variable.rb:124:in `taint_check': undefined method `tainted?' for nil:NilClass (NoMethodError)

$WORKING_DIR is my local directory. The complete output from make serve is here.

It also says

To use retry middleware with Faraday v2.0+, install `faraday-retry` gem

which I've tried using sudo gem install faraday-retry. But that doesn't solve the error.

I've brought my changes to my gh-pages branch, and published the website despite this issue. The website publishes with any problems. But I would prefer to test my edits before publishing.

Do you know what the problem could be?

Some system information (will happily provide more, but please let me know what you need).

$ sw_vers
ProductName:        macOS
ProductVersion:     13.1
BuildVersion:       22C65
zsh --version
zsh 5.8.1 (x86_64-apple-darwin22.0)
bundle --version
Bundler version 2.4.5
zkamvar commented 1 year ago

I believe the message from Faraday is a red herring.

The problem is because liquid 4.0.3 (used by Jekyll) is incompatible with Ruby version 3.2.0 (see https://github.com/github/pages-gem/issues/859).

I believe the solution is to add this to the bottom of the Gemfile:

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.2.0')
    gem 'liquid', '>= 4.0.4'
end

The reason why github pages deploys the site is because it uses ruby 2.7.4: https://pages.github.com/versions/

mtthsdzwn commented 1 year ago

Thanks, works!