Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local render Liquid Exception #242

Closed
awdeorio opened this issue Jan 12, 2023 · 6 comments
Closed

Local render Liquid Exception #242

awdeorio opened this issue Jan 12, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@awdeorio
Copy link
Contributor

I get an error when trying to render locally.

Liquid Exception: undefined method `tainted?' for "en-US":String in /_layouts/spec.html

I'm on the latest main in the public EECS 280 tutorials repo.

$ git remote -v
origin	git@github.com:eecs280staff/tutorials.git (fetch)
origin	git@github.com:eecs280staff/tutorials.git (push)
$ git branch
* main
$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
$ git clean -xdf

Render locally, get an exception.

$ bundle install
$ cd docs/
$ bundle exec jekyll serve
Configuration file: /Users/awdeorio/src/eecs280/tutorials/docs/_config.yml
            Source: /Users/awdeorio/src/eecs280/tutorials/docs
       Destination: /Users/awdeorio/src/eecs280/tutorials/docs/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
      Remote Theme: Using theme eecs485staff/primer-spec
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
  Liquid Exception: undefined method `tainted?' for "en-US":String in /_layouts/spec.html
jekyll 3.9.2 | Error:  undefined method `tainted?' for "en-US":String
/opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/variable.rb:124:in `taint_check': undefined method `tainted?' for "en-US":String (NoMethodError)

      return unless obj.tainted?
                       ^^^^^^^^^
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/variable.rb:89:in `render'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/block_body.rb:103:in `render_node_to_output'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/block_body.rb:80:in `render'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/template.rb:208:in `block in render'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/template.rb:242:in `with_profiling'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/template.rb:207:in `render'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/template.rb:220:in `render!'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/liquid_renderer/file.rb:30:in `block (2 levels) in render!'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/liquid_renderer/file.rb:42:in `measure_bytes'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/liquid_renderer/file.rb:29:in `block in render!'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/liquid_renderer/file.rb:49:in `measure_time'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/liquid_renderer/file.rb:28:in `render!'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/renderer.rb:126:in `render_liquid'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/renderer.rb:195:in `render_layout'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/renderer.rb:158:in `place_in_layouts'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/renderer.rb:88:in `render_document'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/renderer.rb:62:in `run'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/site.rb:479:in `render_regenerated'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/site.rb:472:in `block in render_pages'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/site.rb:471:in `each'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/site.rb:471:in `render_pages'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/site.rb:192:in `render'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/site.rb:71:in `process'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/command.rb:28:in `process_site'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/commands/build.rb:65:in `build'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/commands/build.rb:36:in `process'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/commands/serve.rb:93:in `block in start'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/commands/serve.rb:93:in `each'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/commands/serve.rb:93:in `start'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/jekyll-3.9.2/exe/jekyll:15:in `<top (required)>'
	from /opt/homebrew/lib/ruby/gems/3.2.0/bin/jekyll:25:in `load'
	from /opt/homebrew/lib/ruby/gems/3.2.0/bin/jekyll:25:in `<top (required)>'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `load'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:23:in `run'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/cli.rb:486:in `exec'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/cli.rb:31:in `dispatch'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/cli.rb:25:in `start'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/exe/bundle:48:in `block in <top (required)>'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
	from /opt/homebrew/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/exe/bundle:36:in `<top (required)>'
	from /opt/homebrew/opt/ruby/bin/bundle:25:in `load'
	from /opt/homebrew/opt/ruby/bin/bundle:25:in `<main>'

I get the same error after updating the dependencies.

$ pwd
$ bundle update --all
$ cd docs/
$ bundle exec jekyll serve
...
jekyll 3.9.2 | Error:  undefined method `tainted?' for "en-US":String
/opt/homebrew/lib/ruby/gems/3.2.0/gems/liquid-4.0.3/lib/liquid/variable.rb:124:in `taint_check': undefined method `tainted?' for "en-US":String (NoMethodError)
...

Here's my system:

$ uname -a
Darwin cabra 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64
$ which ruby
/opt/homebrew/opt/ruby/bin/ruby
$ ruby --version
ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]
$ which bundle
/opt/homebrew/opt/ruby/bin/bundle
$ bundle --version
Bundler version 2.3.22
$ which gem
/opt/homebrew/opt/ruby/bin/gem
$ gem --version
3.4.3
@awdeorio awdeorio added the bug Something isn't working label Jan 12, 2023
@noah-weingarden
Copy link
Contributor

noah-weingarden commented Jan 12, 2023

I ran into this myself recently and I think it's because Ruby 3.2 has some breaking changes that Primer Spec's dependencies don't support yet. The solution for me was switching to Ruby 3.1.3.

@awdeorio
Copy link
Contributor Author

Thanks for the work-around @noah-weingarden !

@noah-weingarden
Copy link
Contributor

noah-weingarden commented Jan 13, 2023

Slightly more info: Ruby used to have a feature for taint checking which was removed in Ruby 3.2. Liquid 4.0.3 uses taint checking, so it's incompatible with Ruby 3.2. There are unrelated breaking changes preventing Jekyll from upgrading to Liquid 5.x, so there's a deadlock forcing the use of earlier versions of Ruby while building Jekyll sites for the time being.

@seshrs
Copy link
Member

seshrs commented Jan 13, 2023

Thanks so much for digging into this @noah-weingarden!

@seshrs seshrs closed this as completed Jan 13, 2023
@awdeorio
Copy link
Contributor Author

It might be nice to include a note here. On macOS you need to install ruby@3.1 then add it to your PATH.

@seshrs seshrs reopened this Jan 13, 2023
seshrs added a commit that referenced this issue Jan 21, 2023
@seshrs
Copy link
Member

seshrs commented Jan 21, 2023

I've added a note in 1a7f79a. I'm not certain if Jekyll will backport the fix to Jekyll v3 (which is what GitHub Pages uses by default without GitHub Actions), but I'll keep an eye out for it :)

@seshrs seshrs closed this as completed Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants