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.