Site build unsuccessful

Mac OSX Mojave, Ruby v 2.5.3, Bundler v 1.17.2. Homebrew installed.

This is a noob question but can’t make progress. I’m wanting to run a site of my local machine (which I was doing previously without problems.)

I cloned an existing jekyll site to my desktop and then entered bundle exec jekyll build. Got the error message ‘no gemfile’ so I followed the instructions on the jekyll page to install gems etc.

If I run Jekyll Build I get:
Liquid Exception: Could not locate the included file ‘links.html’ in any of ["/Users/jonathanshearman/Desktop/recover/January/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in /Users/jonathanshearman/Desktop/recover/January/_posts/2015-04-12-test-post-last-year.md
jekyll 3.8.5 | Error: Could not locate the included file ‘links.html’

But the file is not missing.

If I run bundle exec jekyll build, I get

bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/2.5.0/bin/jekyll)

Gem::Exception: can’t find executable jekyll for gem jekyll. jekyll is not currently included in the bundle, perhaps you meant to add it to your Gemfile?
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:462:in block in replace_bin_path' /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:482:inblock in replace_bin_path’
/usr/local/lib/ruby/gems/2.5.0/bin/jekyll:23:in `<top (required)>’

any guidance appreciated

The easiest way someone can help you is if you can give them a link to your fork if it is a public repository.

Nevertheless, let us make do with what’s currently available.

From the error messages, it looks like your site doesn’t have a Gemfile.
When there is no Gemfile, you can’t use bundle exec.
If you have a Gemfile, ensure that you’ve either of the following listed in it:

gem 'jekyll', '~> 3.3'

# **or** if you're deploying via GitHub Pages
gem 'github-pages'

The other error is that Jekyll cannot find an include named links.html. This error occurs when Jekyll can’t find _includes/links.html or another file the include itself is including…
Note:

  • Included file should not be a symlink.
  • _includes/link.html is relative to the site’s source. If you override default source, the include has to change path accordingly.

Sure- GitHub - Texterity/January: This repo is for private training on Jekyll-Git-Atom-Markdown. It’s visible at https://docs.texterity.com.au/.

It’s a sandbox - I’m using a template to learn Jekyll-Markdown-Git. It builds fine on GitHub pages (as can be seen), but I was trying to run it locally, as I had been doing previously. So I cloned the repo using GitHub Desktop, navigated to the directory, and entered bundle exec jekyll serve. That was when I got the error message ‘no gemfile’. Went back and followed the instructions on Jekyll on installing gems and tried again.

so its still not working?

did you try making a gemfile?

what happens if you just run jekyll build? bundler is recommended but not required. Bundler helps keep different gems in sync between different installations so you get the same behavior. I don’t use it.

[ah - I see thats where you get the other error]

are you trying to run the site in the Docs folder?

it almost looks like a jekyll site in the January folder but not quite.

Trying again, getting:

Sirius:January jonathanshearman$ bundle exec jekyll build bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/2.5.0/bin/jekyll) Gem::Exception: can't find executable jekyll for gem jekyll. jekyll is not currently included in the bundle, perhaps you meant to add it to your Gemfile? /usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:462:inblock in replace_bin_path’
/usr/local/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:482:in block in replace_bin_path' /usr/local/lib/ruby/gems/2.5.0/bin/jekyll:23:in<top (required)>’
`

On bundle install:

Sirius:January jonathanshearman$ ls

CNAME Gemfile Gemfile.lock _config.yml _posts docs

'Sirius:January jonathanshearman$ bundle install

The Gemfile specifies no dependencies

Bundle complete! 0 Gemfile dependencies, 1 gem now installed.

Use bundle info [gemname] to see where a bundled gem is installed.’

I took a look inside your repository.

The reason you’re getting the error with Bundler is because your top-level Gemfile has been made redundant by ./docs/Gemfile.

There are two routes to resolve your issue:

  • Plan A: Serving from the root directory:
    • Move ./docs/Gemfile and the lockfile to the root directory at ./ (Replace those files at root)
    • Serve / Build your Jekyll Site from the root directory via:
      bundle exec jekyll serve --source docs --destination docs/_site
      
  • Plan B: Serving from the docs directory.
    • simply cd into your docs folder and build from there:
      cd docs
      bundle exec jekyll serve
      
1 Like

Solved! Thanks a million.

1 Like

@Wayfarer I saw one thorn in your repo. As you were experimenting with your site, you ran a wrong command:

jekyll new .--force

The correct command is jekyll new . --force (whitespace matters)
Nevertheless, do not try that on your site since the correct command will delete your existing site.

You can safely delete the ./.--force directory from your repo. It is not needed and will only confuse new users of your sandbox.

Well, I’m the only user, and it surely confused me!

I’m creating a real site based on this template, but trying out things in the sandbox before committing to the real site. But, thus warned, I will delete that ‘thorn’ from my sandbox, just to keep things neat and tidy.

What I was trying to accomplish by running the site locally, was to use the locally-hosted version for staging, so as not having to push numbers of tiny edits out to the live site while in the edit process.

So the idea is, open the local version in Atom and save changes as you go - you review them on the locally-run version, and then push them out to GitHub when you’ve got a decent bunch of changes. Does that make sense?

Yes, that’s exactly how most of us develop our Jekyll sites. :wink:

Terrific! So I’m on the right track. Thanks for your input and advice, this forum is a great resource.