Cloudflare Pages does not recognize Zola and build fails

This is the first time I’ve ever tried deploying a personal blog using any tool (and, asking for help in a programming forum), so I’m assuming I’m just forgetting a simple step.

I followed the steps in the website, set up the build configurations with the default Values, so the command is zola build and build output directory is /public.

Then I’ve added the environment variable like this

image

And the build logs tell me this

00:04:00.227	HEAD is now at 9cb8515 feat: initial commit
00:04:00.228	
00:04:00.344	
00:04:00.375	Success: Finished cloning repository files
00:04:01.059	Detected the following tools from environment: 
00:04:01.060	Executing user command: zola build
00:04:01.068	/bin/sh: 1: zola: not found
00:04:01.069	Failed: Error while executing user command. Exited with error code: 127
00:04:01.077	Failed: build command exited with code: 1
00:04:01.982	Failed: error occurred while running build command

Because the “detected tools” is empty and zola wasn’t even recognized, I’m assuming it’s either a silly mistake or something weird that’s out of my control.

1 Like

According to this pull request, it seems like the second version of build configs of Cloudflare Pages not installing the zola binary automatically. Switching to version 1 fixes it, and the steps are described in the pull request.

1 Like

Cross posting my comment here v2 build system breaking Zola sites · Issue #3 · cloudflare/pages-build-image · GitHub

Apologies for the issues using the v2 build image. I’ll look into adding Zola.

As a workaround, you can leverage asdf in your build command (or the UNSTABLE_PRE_BUILD env var) and install the zola plugin and version there by prefixing your build command with this rather lengthy set of commands:

asdf plugin add zola https://github.com/salasrod/asdf-zola && asdf install zola 0.17.2 &&  asdf global zola 0.17.2 &&
1 Like

I can use the asdf command method for my build command. It successfully builds all pages. However, my deploy still fails because I don’t know what to add as a deploy command. Everything should be in ./public but I don’t see how to indicate to simply deploy that static site.

Here is the build command updated for version 0.20.0:

asdf plugin add zola https://github.com/salasrod/asdf-zola && asdf install zola 0.20.0 && asdf global zola 0.20.0 && zola build

By default it puts in a wrangle NPM command like npx wrangler deploy. I don’t know if that’s the best way to do it, or what the configuration for wrangle should be, or if there is one that runs faster with less or smaller dependencies.

Sadly, we can no longer switch to v1 of the build system, as far as I can tell.

Doesn’t look like you can change the build version when setting up a new page. Let the first build fail and goto settings for the page, they still have the option there.

Though I am able to get v2 to publish with the asdf plugin command. My current build settings and the Build system version box shown below.

Thanks Laffa. Oddly, my settings looks different than yours, with no build system version setting.

To be clear, it seems like zola build executes just fine:

07:46:44.278	Downloading [zola] from https://github.com/getzola/zola/releases/download/v0.20.0/zola-v0.20.0-x86_64-unknown-linux-gnu.tar.gz to /tmp/asdf_Ax5sxgQJ/zola-v0.20.0-x86_64-unknown-linux-gnu.tar.gz
07:46:44.323	  [removed download info]
07:46:45.458	Creating bin directory
07:46:45.459	Cleaning previous binaries
07:46:45.462	Extracting archive
07:46:45.869	Copying binary
07:46:46.228	Building site...
07:46:46.272	Checking all internal links with anchors.
07:46:46.276	> Successfully checked 0 internal link(s) with anchors.
07:46:46.277	-> Creating 18 pages (0 orphan) and 25 sections
07:46:46.769	Done in 541ms.
07:46:46.770	
07:46:46.773	Success: Build command completed

But the deploy fails. What do you have as the deploy command? I don’t have an ‘build output’ setting.

I seem to have made a mistake before. I was under the belief that ‘Zola’ was not in the Framework Present list. Having remade a page from scratch, I can now have it deploy.