HUGO

After relocating hugo site, "unable to locate config file"

Hi, looked around and I see similar topics but not exactly my situation.

Had hugo site on laptop. Still there, works fine. I run hugo on it from site dir to build the site each time, no problem.

I now want to use my desktop. All files are in place, I see the config.toml right there. I go to the site dir, run Hugo, and get this error:
Error: Unable to locate config file or config directory. Perhaps you need to create a new site.
Run hugo help new for details.

Not sure why. My guesses are:

  • hugo doesn’t “know” about this dir, maybe I need to specify somewhere. the config.toml points to my domain online, as it should
  • permission issue, especially for Hugo (since this is linux). Wasn’t a problem before, maybe it is now?

What do you think?

You could try running hugo with the --ignoreCache flag and seeing what happens. Maybe the cache is still looking in the old location. I’'m no expert on the details of Hugo, but that’s my guess.

We don’t have enough info to help you. Share your code. Or create a minimal reproducible example (this exercise may help you find the issue yourself).

1 Like

Code from where? my Config.toml? I can’t create a sample because hugo quits right away with the above error. What can I do to give you more information exactly?

Solved. This was an issue with my Hugo installation (snappy). I downloaded the binary directory to the site’s dir, ran it there, and all is well.

1 Like

This solution worked for me as well, thanks! Not sure what’s the difference between snap package and the source files.