Repository navigation
document_url_regex': undefined method each' for nil:NilClass (NoMethodError)` with jekyll-polyglot-1.5.0 / jekyll 4.0.1 #151
Description
Activity
So that last line of the stacktrace corresponds to here:
site.rb:171:in `document_url_regex': undefined method `each' for nil:NilClass (NoMethodError)https://github.com/untra/polyglot/blob/master/lib/jekyll/polyglot/patches/jekyll/site.rb#L171
in this case ruby doesn't think@languageshas been defined, which should come from the polyglot configuration
https://github.com/untra/polyglot#configurationI would think your build process is not passing along the correct or full _config.yml ?
polyglot should probably handle missing input or configuration better fwiw
Reacted by KyleI'm passing a valid
_config.ymltojekyll doctorbut I'm still getting the error. This is the exact yaml file I'm passing tobundle exec jekyll serve(which works fine) andbundle exec jekyll doctor(which doesn't).title: Linaro url: https://www.linaro.org baseurl: "" description: |- Linaro is a collaborative engineering organization consolidating and optimizing open source software and tools for the Arm architecture. destination: _site permalink: /:categories/:title/ theme: linaro-jekyll-theme highlighter: rouge markdown: kramdown kramdown: input: GFM syntax_highlighter: rouge encoding: utf-8 safe: false livereload_ignore: - .asset_pipeline/assets/js/*.js - .asset_pipeline/assets/js/*.js.gz exclude: - Gemfile - Gemfile.lock - .asset_pipeline - build-site.sh - check-links.sh - CODEOWNERS - README.md - .gitignore - .git - .asset-cache - _static-site - .sass-cache - staging.linaro.org - production.linaro.org # Breadcrumb banner image breadcrumb_banner: /assets/images/content/code_banner.jpg # Toggle the animated navbar dropdown feature # Navbar dropdowns will open on hover hover_nav_dropdowns: true # Set the class used to animate dropdowns e.g. fade-up / fade-down nav_dropdowns_animation_class: fade-down # The bootstrap breakpoint at which the navbars will expand nav_expand_breakpoint: xl sass: style: compressed load_paths: - assets/css sourcemap: "never" plugins: - japr - jekyll_picture_tag - jekyll-tidy collections: company: output: true permalink: /membership/:name/ services: output: true themes: output: true core: output: true permalink: /:collection/:path/ authors: output: true permalink: /author/:name/ internships: output: true permalink: /careers/internships/:name/ liquid: error_mode: strict defaults: - scope: path: "" values: image: /assets/images/social-media-image.png - scope: path: "_pages" values: layout: flow - scope: type: posts path: "_posts" values: layout: post is_post: true tags_enabled: true comments: false image: /assets/images/content/code_banner.jpg strap_image: /assets/images/content/code_banner.jpg - scope: path: "" type: "authors" values: layout: author sitemap: false image: /assets/images/social-media-image.png - scope: type: "services" values: layout: flow css_bundle: services js-package: services image: /assets/images/content/LinaroDSVertical.png - scope: type: "themes" values: layout: flow css_bundle: themes js-package: themes image: /assets/images/content/LinaroDSVertical.png - scope: path: "_posts/events" values: layout: event comments: false tags_enabled: false author: linaro permalink: /events/:title/ categories: ["Events"] - scope: path: "_posts/events/resources" values: layout: resource-post comments: false tags_enabled: false author: linaro permalink: /events/:title/ categories: ["event_resources"] - scope: path: "_posts/awards" values: author: linaro tags_enabled: false permalink: "/awards/5-years/:title/" comments: false - scope: path: "assets/**/*.pdf" values: sitemap: false - scope: path: "admin" values: sitemap: false - scope: path: app values: sitemap: false - scope: path: remote values: sitemap: false - scope: path: "_pages/projects/" values: sitemap: false - scope: path: "" type: "company" values: layout: flow flow: - row: container_row sections: - format: custom_include source: display_company_info.html - scope: type: "internships" values: layout: vacancy # - scope: # path: "/sitemap.xml" # values: # redirect_from: /sitemap/ include: ["_pages"] # ----------- THEME / WEBSITE CONFIG --------------------- # Blog images/thumbs dir blog_images_dir: assets/images/content/ # Email email: contact@linaro.org # Company Address address: - Harston Mill - Royston Rd, Harston - Cambridge, United Kingdom - CB22 7GG # Support for http2 preload features http2_resources: - rel: preload as: font type: font/woff2 crossorigin: true href: /assets/fonts/lato/Lato-regular.woff2 google_analytics: enabled: true code: GTM-XXXXX cookies: necessary: - name: cookieControl description: > This is used to control the display of the preferences pop up. Without this, we wouldn't know if you've clicked Accept! - name: cookieControlPrefs description: > This is used to store your cookie preferences. Without this we wouldn't know which cookies you want! marketing: - name: _ga description: > 2 years - Used to distinguish users. - name: _gid description: > 24 hours - Used to distinguish users. - name: _gat description: > 1 minute - Used to throttle request rate. - name: HotJar description: > We use hotjar to help us understand how we can improve our end-user experience. For a list of cookies HotJar uses please see [https://help.hotjar.com/hc/en-us/articles/115011789248-Hotjar-Cookies#cookies-set-by-the-hotjar-script](https://help.hotjar.com/hc/en-us/articles/115011789248-Hotjar-Cookies#cookies-set-by-the-hotjar-script) # Set the site-wide default social media share image. social_media_share_image: /assets/images/social-media-image.png # Set the default favicon favicon: /assets/images/favicon.png # Site Name - your brand name name: Jumbo Jekyll Theme # The blog filler element blog_filler_element: blog/blog_filler_element.html # Placeholder avatar avatar_placeholder: /assets/images/avatar-placeholder.jpg # Blog Post Image Placeholder post_placeholder: /assets/images/content/linaro-logo.png # Social Media Links social_media_channels: github: url: https://github.com/Linaro linkedin: url: https://www.linkedin.com/company/1026961 facebook: url: http://facebook.com/LinaroOrg youtube: url: https://www.youtube.com/linaroorg twitter: url: https://twitter.com/linaroorg instagram: url: https://instagram.com/linaroorg # Disqus Comments Setup disqus: enabled: false shortname: Linaro # Edit on GitHub Settings edit-on-github: enabled: true repo: https://www.github.com/Linaro/website # Breadcrumb schema breadcrumb_schema: true # Shema.org settings used in the schema.html include. schema: "@context": "https://schema.org" "@type": "Organization" "name": "Linaro" "url": "https://www.linaro.org" "email": "contact@linaro.org" "logo": "https://www.linaro.org/assets/images/content/linaro-logo.png" "contactPoint": "@type": "ContactPoint" "telephone": "01223 400060" "contactType": "customer service" "availableLanguage": "en" "sameAs": "https://www.linaro.org" # FESS search label search_label: Linaro # ----------- JEKYLL PLUGINS --------------------- # -------- jekyll-tidy -------- jekyll_tidy: # Toggle compression of HTML compress_html: true # JS Path added to exclude to stop errors. exclude: ["assets/**/*.js", "robots.txt", "admin/config.yml"] # -------- jekyll_relative_links -------- jekyll_relative_links: process_all_collections: true verbose: 1 relative_links: enabled: true collections: false # -------- jekyll_relative_links -------- readme_index: enabled: true remove_originals: false # -------- jekyll_picture_tag -------- picture: nomarkdown: false suppress_warnings: true source: "" output: "../generated" relative_url: true disabled: false # -------- japr -------- asset_pipeline: bundle: true compress: true output_path: assets/js gzip: true # Jekyll-polyglot i18n_enabled: true languages: ["en", "ja"] default_lang: "en" exclude_from_localization: ["javascript", "images", "css", "public", "assets", "generated"] parallel_localization: false
Just for our sanity here is the stack trace when explicitly running jekyll doctor which is using the above Jekyll
_config.ymlfile.bundle exec jekyll doctor --trace Configuration file: /home/god/Git/linaro.org/_config.yml Theme Config file: /home/god/.rvm/gems/ruby-2.6.6/gems/linaro-jekyll-theme-5.0.1/_config.yml Traceback (most recent call last): 21: from /home/god/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>' 20: from /home/god/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval' 19: from /home/god/.rvm/gems/ruby-2.6.6/bin/jekyll:23:in `<main>' 18: from /home/god/.rvm/gems/ruby-2.6.6/bin/jekyll:23:in `load' 17: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-4.0.1/exe/jekyll:15:in `<top (required)>' 16: from /home/god/.rvm/gems/ruby-2.6.6/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program' 15: from /home/god/.rvm/gems/ruby-2.6.6/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go' 14: from /home/god/.rvm/gems/ruby-2.6.6/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute' 13: from /home/god/.rvm/gems/ruby-2.6.6/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each' 12: from /home/god/.rvm/gems/ruby-2.6.6/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute' 11: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-4.0.1/lib/jekyll/commands/doctor.rb:17:in `block (2 levels) in init_with_program' 10: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-4.0.1/lib/jekyll/commands/doctor.rb:25:in `process' 9: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-4.0.1/lib/jekyll/site.rb:176:in `read' 8: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-4.0.1/lib/jekyll/hooks.rb:101:in `trigger' 7: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-4.0.1/lib/jekyll/hooks.rb:101:in `each' 6: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-4.0.1/lib/jekyll/hooks.rb:102:in `block in trigger' 5: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-polyglot-1.5.0/lib/jekyll/polyglot/hooks/coordinate.rb:4:in `block in <top (required)>' 4: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-polyglot-1.5.0/lib/jekyll/polyglot/hooks/coordinate.rb:19:in `hook_coordinate' 3: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-polyglot-1.5.0/lib/jekyll/polyglot/hooks/coordinate.rb:19:in `each' 2: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-polyglot-1.5.0/lib/jekyll/polyglot/hooks/coordinate.rb:20:in `block in hook_coordinate' 1: from /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-polyglot-1.5.0/lib/jekyll/polyglot/patches/jekyll/site.rb:127:in `coordinate_documents' /home/god/.rvm/gems/ruby-2.6.6/gems/jekyll-polyglot-1.5.0/lib/jekyll/polyglot/patches/jekyll/site.rb:171:in `document_url_regex': undefined method `each' for nil:NilClass (NoMethodError)
when you're running this command
jekyll doctor, is this in a totally fresh environment? eg. are you runningjekyll buildbeforehand?I actually didn't know about that
jekyll doctorcommand and don't have a test for polyglot with it, but from what I understand it checks for missing paths / config in files, and the nature of a polyglot I think would expect the files have already been written out before it can check them?jekyll doctorcalls site process, but likely doesn't preprocess for the doctor command. I think that may be the bug here.when you're running this command jekyll doctor, is this in a totally fresh environment? eg. are you running jekyll build beforehand?
I'm not running
jekyll buildprior but do have built site folders in the site repo.I actually didn't know about that jekyll doctor command and don't have a test for polyglot with it, but from what I understand it checks for missing paths / config in files, and the nature of a polyglot I think would expect the files have already been written out before it can check them?
jekyll doctor calls site process, but likely doesn't preprocess for the doctor command. I think that may be the bug here.
You definitely understand the inner workings of Jekyll/ruby better than I do so I'll trust you on this 😄
I ran in to this today with Jekyll 4.3.2:
(.venv) dan@localhost ~/P/gaphor.github.io (main)> bundle exec jekyll doctor Configuration file: /home/dan/Projects/gaphor.github.io/_config.yml jekyll 4.3.2 | Error: undefined method `each' for nil:NilClass Traceback (most recent call last): 34: from /home/dan/.rbenv/versions/2.7.5/bin/bundle:23:in `<main>' 33: from /home/dan/.rbenv/versions/2.7.5/bin/bundle:23:in `load' 32: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/exe/bundle:33:in `<top (required)>' 31: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors' 30: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/exe/bundle:45:in `block in <top (required)>' 29: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/cli.rb:28:in `start' 28: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start' 27: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/cli.rb:34:in `dispatch' 26: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' 25: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' 24: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' 23: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/cli.rb:492:in `exec' 22: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:23:in `run' 21: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:58:in `kernel_load' 20: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.4.10/lib/bundler/cli/exec.rb:58:in `load' 19: from /home/dan/.rbenv/versions/2.7.5/bin/jekyll:23:in `<top (required)>' 18: from /home/dan/.rbenv/versions/2.7.5/bin/jekyll:23:in `load' 17: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-4.3.2/exe/jekyll:15:in `<top (required)>' 16: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program' 15: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go' 14: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute' 13: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each' 12: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute' 11: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-4.3.2/lib/jekyll/commands/doctor.rb:17:in `block (2 levels) in init_with_program' 10: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-4.3.2/lib/jekyll/commands/doctor.rb:25:in `process' 9: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-4.3.2/lib/jekyll/site.rb:183:in `read' 8: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-4.3.2/lib/jekyll/hooks.rb:102:in `trigger' 7: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-4.3.2/lib/jekyll/hooks.rb:102:in `each' 6: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-4.3.2/lib/jekyll/hooks.rb:103:in `block in trigger' 5: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-polyglot-1.5.1/lib/jekyll/polyglot/hooks/coordinate.rb:4:in `block in <top (required)>' 4: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-polyglot-1.5.1/lib/jekyll/polyglot/hooks/coordinate.rb:19:in `hook_coordinate' 3: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-polyglot-1.5.1/lib/jekyll/polyglot/hooks/coordinate.rb:19:in `each' 2: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-polyglot-1.5.1/lib/jekyll/polyglot/hooks/coordinate.rb:20:in `block in hook_coordinate' 1: from /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-polyglot-1.5.1/lib/jekyll/polyglot/patches/jekyll/site.rb:127:in `coordinate_documents' /home/dan/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/jekyll-polyglot-1.5.1/lib/jekyll/polyglot/patches/jekyll/site.rb:171:in `document_url_regex': undefined method `each' for nil:NilClass (NoMethodError)This bug should be addressed in 1.7.0 . Please let me know if this is still a problem 👍
Hi @untra,
As requested :)
We're using a custom docker container we've built for building our multiple Jekyll sites.
This is the entry script in the container where you can see
jekyll doctoris being executed prior to building the site.https://github.com/linaro-its/jekyll-build-container/blob/master/build-site.sh
This is what the
build-site.shscript looks like that I'm running below (not to be confused with thebuild-site.shentry script 🤦🏼♂️https://github.com/Linaro/website/blob/master/build-site.sh
Hoping you can shed some light on what's going on here 🤞🏼
Cheers!
Kyle