Running Jekyll with recently released Ruby version 3.2 may result in the following error:
/liquid-4.0.3/lib/liquid/variable.rb:124:in `taint_check': undefined method `tainted?'
Background
Based on a Jekyll issues list discussion, this appears to be related to differences between dependency Liquid’s versions 4 and 5.
Solution
(Updated Jan. 13) A more permanent solution is now available with the release of Liquid v4.0.4, and updating the Liquid dependency should allow a Jekyll site to run on Ruby 3.2.
ruby -v
can be used within the project directory to first check the current Ruby version, and if it’s not 3.2 and .ruby-version
exists it may need to be removed or updated to point to Ruby 3.2.
Then try bundle update liquid
while running Ruby 3.2 and, once updated, run jekyll serve
again to see the result.*
[*Ideally this is done in an experimental branch under version control, and if any problems are encountered then changes to the affected file Gemfile.lock
(and .ruby-version
if it was changed) may be discarded.]
(Updated Jan. 11) If Ruby 3.2 is a must-have, then there is an existing Jekyll pull request that can be specified, as directed by this comment.
Otherwise, a quick solution (and a more stable one, for the moment) is to use a Ruby version less than 3.2 until the incompatibility is resolved.
With a Ruby version manager, this can be accomplished by adding the following file (referencing v3.1.3 for example) to the root directory of your Jekyll project*:
# .ruby-version
3.1.3
(*And of course you’ll need to have or install the specified version.)