Jekyll build fails - `sort_docs!': no implicit conversion of String into Integer

Hi everyone,

I installed Jekyll 4.0 using the Windows install instructions here, and it looked like everything went well, but when I run jekyll build --trace, I get:

    Traceback (most recent call last):
            22: from C:/Ruby26-x64/bin/jekyll:23:in `<main>'
            21: from C:/Ruby26-x64/bin/jekyll:23:in `load'
            20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/exe/jekyll:15:in `<top (required)>'
            19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
            18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
            17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
            16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
            15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
            14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
            13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `process_with_graceful_fail'
            12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `each'
            11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `block in process_with_graceful_fail'
            10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:36:in `process'
             9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:65:in `build'
             8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:28:in `process_site'
             7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:74:in `process'
             6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:174:in `read'
             5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/reader.rb:20:in `read'
             4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/readers/collection_reader.rb:17:in `read'
             3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/readers/collection_reader.rb:17:in `each_value'
             2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/readers/collection_reader.rb:18:in `block in read'
             1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/collection.rb:68:in `read'
    C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/collection.rb:223:in `sort_docs!': no implicit conversion of String into Integer (TypeError)

jekyll serve --trace shows the same. Obviously there’s an issue with 'sort_docs!, but I don’t know how to fix it. Any ideas?

Hi… Did you fork and clone an existing repository or just customized the boilerplate from
jekyll new…? If it was the former case, I’d like to know the repo’s location. Otherwise, I’d like to see the contents of your config file.

Hi - thanks very much for your response!

So…I’m gonna level with you. I’m not a developer, nor am I very tech savvy, plus my purpose for using Jekyll is likely a bit unconventional, so while I absolutely welcome any advice you might have, you should know that I might need quite a bit of hand-holding through this.

With that warning out of the way, here are the contents of the _config.yml file:

collections:

  apis:
    output: true

  defaults:
    - scope:
        path: ""
        type: "apis"
      values:
        layout: "api"
    - scope:
        path: ""
      values:
        layout: "default"

Any ideas? I really appreciate any help you could provide.

The configuration looks sane and benign. So perhaps there’s an offending filename…
Please post the complete output from running the following:

bundle exec jekyll build --verbose --trace

or if there is no Gemfile in your project directory, then

jekyll build --verbose --trace

No gemfile in the directory. Here’s the output:

  Logging at level: debug
    Jekyll Version: 4.0.0
Configuration file: C:/Users/ash/Documents/JekyllRoot/_config.yml
            Source: C:/Users/ash/Documents/JekyllRoot
       Destination: C:/Users/ash/Documents/JekyllRoot/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       EntryFilter: excluded /Gemfile.txt
Traceback (most recent call last):
        22: from C:/Ruby26-x64/bin/jekyll:23:in `<main>'
        21: from C:/Ruby26-x64/bin/jekyll:23:in `load'
        20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/exe/jekyll:15:in `<top (required)>'
        19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `process_with_graceful_fail'
        12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `each'
        11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `block in process_with_graceful_fail'
        10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:36:in `process'
         9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:65:in `build'
         8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:28:in `process_site'
         7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:74:in `process'
         6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:174:in `read'
         5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/reader.rb:20:in `read'
         4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/readers/collection_reader.rb:17:in `read'
         3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/readers/collection_reader.rb:17:in `each_value'
         2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/readers/collection_reader.rb:18:in `block in read'
         1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/collection.rb:68:in `read'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/collection.rb:223:in `sort_docs!': no implicit conversion of String into Integer (TypeError)

I see a line saying excluded /Gemfile.txt in the output.
Having a file named Gemfile.txt is not an ordinary sight. I’m now curious to see the actual contents of your source directory.

Will you be able to upload the source directory as is to the internet and let me have a look at it…?

Will this work?

https://drive.google.com/open?id=1UTfKZMND7dR9_mIhNagEDeAgDGL0Hg6-

What you uploaded is your Ruby installation files.
I was instead referring to the contents of your Jekyll site’s source directory…
i.e., the contents of C:/Users/ash/Documents/JekyllRoot

Sorry about that…here you go.

https://drive.google.com/open?id=1IqeZuhSgM_mrcHvl9dMl0sqzskBk7Hsn

The error is in your config file.
YAML is indentation-sensitive. The entire defaults block is indented 2 spaces more than key collection. Therefore, it gets interpreted as a separate collection.

Wrong

collections:
  apis:
    output: true

  defaults:
    - scope:
        path: ""
        type: "apis"
      values:
        layout: "api"

Right

collections:
  apis:
    output: true

defaults:
  - scope:
      path: ""
      type: "apis"
    values:
      layout: "api"

You’re right, that fixed it. Thank you, thank you, thank you very much for all your help with this!