Help deploying to Cloudflare—Error: unable to locate config file

I am stuck. I am trying to deploy hugo-scroll themed website from Github on Cloudflare and I am getting the error message :

Error: Unable to locate config file or config directory. Perhaps you need to create a new site.

I am using hugo v0.105.0+extended and have added this as an environmental variable along with another variable “HUGO_ENV - production” which seemed to have no effect.

I have read that maybe I am not running the hugo in the root directory but I believe that I have done this, unless I am misunderstanding how to run the command in the root.

I also read an old topic in here that said that maybe I committed the public directory and I need to remove the public folder from the root directory?

Any advice would be much appreciated. I can not find anything in the archived topics or online.

Thank you

Can you share your repository with us?

1 Like

It’s empty.

I committed it to trunk not main. I am still a bit new you GitHub and changed the main branch to trunk when I first set it up. Is that the issue?

It should till be accessible though. I did try deploying to cloudflare from trunk but that did not work either.

Well, if Cloudflare is looking at an empty repo, it certainly isn’t going to find a config.toml file, which would explain the error. Did you follow their instructions?
https://developers.cloudflare.com/pages/framework-guides/deploy-a-hugo-site/

Since you are learning a lot of things all at the same time, keep it simple—go with defaults.

Thank you! I even looked at this page but missed things, including this command: git submodule update --init --recursive

This looks like it will have the answer to my problem. Is having trunk as my default branch an issue on GitHub? I am unsure how to merge them now. Thank you, I am learning a lot of things at the same time which does seem to be causing me problems. I appreciate your help.

trunk is not your default branch on GitHub. It’s just a branch.

And when I clone your site with git clone --recurse-submodules ... the theme is not present, so you made a mistake when you installed the theme.

1 Like

I understand. I will start over. Thanks again for your help

I was finally successful at deploying it today thanks to all your help! Thanks again!

2 Likes