Search code examples
rubyjekyllcloudflaregemfilecloudflare-pages

Updating Cloudflare Pages to Ruby 3 for Jekyll site


So I've been building a blog site using Jekyll and an specific theme called Chirpy, and deploying it all using Cloudflare Pages, the code is stored in a private Github repository so anytime I push code a new build gets generated by Cloudflare automatically.

It's been working fine for months but after some updates deploying a new build fails as:

12:57:58.188    Success: Finished cloning repository files
12:57:58.890    Installing dependencies
12:57:58.901    Python version set to 2.7
12:58:03.233    v12.18.0 is already installed.
12:58:04.608    Now using node v12.18.0 (npm v6.14.4)
12:58:04.922    Started restoring cached build plugins
12:58:04.937    Finished restoring cached build plugins
12:58:05.597    Attempting ruby version 2.7.1, read from environment
12:58:09.668    Using ruby version 2.7.1
12:58:10.041    Using PHP version 5.6
12:58:10.042    Started restoring cached ruby gems
12:58:10.060    Finished restoring cached ruby gems
12:58:10.062    Installing gem bundle
12:58:10.368    [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path '/opt/buildhome/cache/bundle'`, and stop using this flag
12:58:10.526    [DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs`
12:58:13.673    Fetching gem metadata from https://rubygems.org/..........
12:58:13.834    Fetching gem metadata from https://rubygems.org/.
12:58:13.935    Resolving dependencies...
12:58:14.019    sass-embedded-1.58.0-x86_64-linux-musl requires rubygems version >= 3.3.22,
12:58:14.019    which is incompatible with the current version, 3.1.2
12:58:14.052    Error during gem install
12:58:14.073    Failed: build command exited with code: 1
12:58:14.848    Failed: an internal error occurred

Now Cloudflare allows you to specify which command you want to use in order to execute the build, that being:

bundle exec jekyll b

I've been looking for a way to update the Ruby version being used in Cloudflare and could not find any resources more than this one post. I've tried changing the Gemfile like:

spec.required_ruby_version = ">= 3.0"

, but it seems like Cloudflare does not support Ruby 3 at all; I then had the idea to use an older version of the Chirpy theme, since I already have a deployed version of the blog, I went back to Chirpy 5.2.1 but surprisingly the error persist.


Solution

  • Definitely adding gem "jekyll-sass-converter", "~> 2.0" to the Gemfile solved this problem, as Christian mentioned.