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

undefined method `include?' for nil:NilClass #197

Open
pelcasandra opened this issue Dec 22, 2022 · 1 comment
Open

undefined method `include?' for nil:NilClass #197

pelcasandra opened this issue Dec 22, 2022 · 1 comment

Comments

@pelcasandra
Copy link

pelcasandra commented Dec 22, 2022

I want to report a bug:

What is the current behavior?

bundle exec jekyll algolia
Configuration file: /root/site/_config.yml
Processing site...                                                               
jekyll 4.3.1 | Error:  undefined method `include?' for nil:NilClass

        translate_posts = !site.config['exclude_from_localizations'].include?("_posts")
                                                                    ^^^^^^^^^
/root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-multiple-languages-plugin-1.8.0/lib/jekyll-multiple-languages-plugin.rb:251:in `read_posts': undefined method `include?' for nil:NilClass (NoMethodError)

        translate_posts = !site.config['exclude_from_localizations'].include?("_posts")
                                                                    ^^^^^^^^^
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/reader.rb:91:in `retrieve_posts'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/reader.rb:76:in `read_directories'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/reader.rb:16:in `read'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:181:in `read'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll/algolia/overwrites/jekyll-algolia-site.rb:23:in `process'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll-algolia.rb:82:in `run'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll/commands/algolia.rb:38:in `block (2 levels) in init_with_program'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/exe/jekyll:15:in `<top (required)>'
	from /root/3.1.2/bin/jekyll:25:in `load'
	from /root/3.1.2/bin/jekyll:25:in `<top (required)>'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `load'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:23:in `run'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:486:in `exec'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:31:in `dispatch'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:25:in `start'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/exe/bundle:48:in `block in <top (required)>'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
	from /root/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/exe/bundle:36:in `<top (required)>'
	from /root/3.1.2/bin/bundle:25:in `load'
	from /root/3.1.2/bin/bundle:25:in `<main>'

What is your expected behavior?

I would expect it to create index the pages into algolia.

Git repository to reproduce the issue:

https://github.com/hellotext/help

Ruby version used:

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]

Jekyll version used:

jekyll 4.3.1

@pelcasandra
Copy link
Author

It seems jekyll-algolia plugin doesnt play well with jekyll-multiple-languages-plugin.

According to their docs, the error above can be prevented by specifying in _config.yml the following:

exclude_from_localizations: ["javascript", "images", "css"]

However, this returns now a different error when running bundle exec jekyll algolia:

bundle exec jekyll algolia
Configuration file: /root/site/_config.yml
Processing site...                                                               
Loading translation from file /root/site/_i18n/.yml                                                                                                     |
jekyll 4.3.1 | Error:  No such file or directory @ rb_sysopen - /root/site/_i18n/.yml
/root/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:670:in `initialize': No such file or directory @ rb_sysopen - /root/site/_i18n/.yml (Errno::ENOENT)
	from /root/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:670:in `open'
	from /root/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:670:in `load_file'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-multiple-languages-plugin-1.8.0/lib/jekyll-multiple-languages-plugin.rb:25:in `block in <module:Jekyll>'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/hooks.rb:103:in `block in trigger'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/hooks.rb:102:in `each'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/hooks.rb:102:in `trigger'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/lib/jekyll/site.rb:208:in `render'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll/algolia/overwrites/jekyll-algolia-site.rb:34:in `process'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll-algolia.rb:82:in `run'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-algolia-1.7.1/lib/jekyll/commands/algolia.rb:38:in `block (2 levels) in init_with_program'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/jekyll-4.3.1/exe/jekyll:15:in `<top (required)>'
	from /root/.rbenv/versions/3.1.2/bin/jekyll:25:in `load'
	from /root/.rbenv/versions/3.1.2/bin/jekyll:25:in `<top (required)>'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `load'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:23:in `run'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:486:in `exec'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:31:in `dispatch'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:25:in `start'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/exe/bundle:48:in `block in <top (required)>'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
	from /root/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/exe/bundle:36:in `<top (required)>'
	from /root/.rbenv/versions/3.1.2/bin/bundle:25:in `load'
	from /root/.rbenv/versions/3.1.2/bin/bundle:25:in `<main>'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant