Jekyll not working in CloudFlare Pages

I was trying to use Jekyll with Cloudflare pages, but no matter what I do it doesn’t work.

Various errors I’ve got:

  1. /bin/sh: 1: jekyll: not found
  2. Could not find rexml-3.2.5 in any of the sources
  3. Could not find minima-2.5.1, jekyll-feed-0.16.0, jekyll-seo-tag-2.7.1, rexml-3.2.5 in any of the sources

My page:

It builds fine (make all) on my Ubuntu 20.04 machine.

I would recommend reading the documentation about Deploy a Jekyll site. There is described how to install Jekyll. After this is done, the error:

/bin/sh: 1: jekyll: not found

should not appear anymore.
Since we dont know what exactly your settings are it’s hard to help.

1 Like

There’s no rbenv on the cloudflare builder machines. Trying to use rbenv results in “rbenv: not found”.

As I said, I was able to get Jekyll working on my local machine. Just not on the builder machines.

I did not configure anything on the builders - just empty environment and am using a Makefile to run the build process, which calls the necessary commands.

I was attempting the following commands

cd blog && jekyll build
gem install bundler jekyll && cd blog && jekyll build
gem install bundler jekyll && cd blog && bundle exec jekyll build

I created the Gemfile/Gemfile.lock in my local machine. They are in the git repo in the OP.

Thats does not matter at all, since your local machine cant help you making it work on Cloudflare Pages.

I repeate:

Since you are not providing any info indicating how exactly your Pages Setup/Config is, it’s hard to help.

Anyway, please make sure you use the correct Build configuration and select it like:

For using Ruby commands you probably also want to include Ruby in a version you desire.

Does setting framework preset to Jekyll automagically make Jekyll show on PATH?

Apparently Jekyll will only exist when you do the “click setting framework preset to Jekyll” thing, and not otherwise. Fun magic.

And not using the Jekyll that comes from the framework preset will not work, I guess because of Ruby stuff.

You can just use this tutorial to install the version of Jekyll you want: https://developers.cloudflare.com/pages/framework-guides/deploy-a-jekyll-site

1 Like

@M4rt1n the docs state this:

You should see Cloudflare Pages installing jekyll

With a build configuration that looks like your screenshot there is no such installation occurring and it looks like Hugo:

2022-11-12T14:59:38.26158Z Cloning repository…
2022-11-12T14:59:40.024135Z From github dot com/my/repo
2022-11-12T14:59:40.024764Z * branch c8786ca7692b085701128afadee7c76cb5df3447 → FETCH_HEAD
2022-11-12T14:59:40.024947Z
2022-11-12T14:59:40.229526Z HEAD is now at c8786ca Added 2 files
2022-11-12T14:59:40.230171Z
2022-11-12T14:59:40.455549Z
2022-11-12T14:59:40.485822Z Success: Finished cloning repository files
2022-11-12T14:59:41.174513Z Installing dependencies
2022-11-12T14:59:41.186517Z Python version set to 2.7
2022-11-12T14:59:44.858872Z v12.18.0 is already installed.
2022-11-12T14:59:46.104305Z Now using node v12.18.0 (npm v6.14.4)
2022-11-12T14:59:46.325173Z Started restoring cached build plugins
2022-11-12T14:59:46.340812Z Finished restoring cached build plugins
2022-11-12T14:59:46.847924Z Attempting ruby version 2.7.1, read from environment
2022-11-12T14:59:50.469792Z Using ruby version 2.7.1
2022-11-12T14:59:50.838037Z Using PHP version 5.6
2022-11-12T14:59:51.003599Z 5.2 is already installed.
2022-11-12T14:59:51.033168Z Using Swift version 5.2
2022-11-12T14:59:51.033511Z Installing Hugo 0.54.0
2022-11-12T14:59:51.718539Z Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
2022-11-12T14:59:51.722332Z Started restoring cached go cache
2022-11-12T14:59:51.742974Z Finished restoring cached go cache
2022-11-12T14:59:51.888963Z go version go1.14.4 linux/amd64
2022-11-12T14:59:51.905296Z go version go1.14.4 linux/amd64
2022-11-12T14:59:51.908266Z Installing missing commands
2022-11-12T14:59:51.908546Z Verify run directory
2022-11-12T14:59:51.908723Z Executing user command: jekyll build
2022-11-12T14:59:51.913814Z /opt/build/bin/build: line 39: jekyll: command not found
2022-11-12T14:59:51.919171Z Failed: build command exited with code: 127
2022-11-12T14:59:53.192066Z Failed: an internal error occurred

No sign of Hugo here though:

You need to have your Gemfile committed to the repo for Cloudflare pages to pick it up during the CI process. See my blog repo which uses Jekyll and is hosted on Cloudflare Pages.

1 Like

@Cyb3r-Jak3 thanks, but I do have a Gemfile committed:

source 'https://rubygems.org'

gem "jekyll"
gem "classifier-reborn"
gem "json"
gem "kramdown-parser-gfm"

group :jekyll_plugins do
  gem "jekyll-sitemap"
  gem "jekyll-archives"
  gem "jekyll-last-modified-at"
  gem "jekyll-paginate-v2"
end

If your repo is public, can you share a link to it. It will quicker for me to debug.

2 Likes