Netlify Site Does Not Deploy

I’m having a lot of trouble trying to get my site to deploy on Netlify.

Running into errors like…
Error: Unable to find theme Directory: /themes/XXX.
Error running command: Build script returned non-zero exit code: 255
Failing build: Failed to build site
failed during stage ‘building site’: Build script returned non-zero exit code: 255
Finished processing build request in 10.471068044s

Is there any Netlify support I can contact? Or a fix to these errors?

Thanks!

There are a bunch of posts on this forum related to Netlify, but this is the Hugo forum so you might have better luck looking on Netlify’s site.

Does your site work on your own computer when you run hugo server from site’s directory?

Yes it does, and I have tested with multiple themes, all work.

I have also created a new site and repository and started the process all over with a new theme, and that too works very well on my system.

It is just when deploying to Netlify they all fail, with the error message Error: Unable to find theme Directory: /themes/XXX, XXX being the theme directory and name.

And also, “Error running command: Build script returned non-zero exit code: 255” which I understand is not using the correct Hugo version, but I started using netlify.toml, so that shouldn’t be an issue.

So the error message has XXX in it?

Do you have theme = "" set correctly in config.toml? And have you set baseURL = ""?

No the theme name like whiteplain, hugo-theme-jane, etc.

I used XXX as I’ve tried with multiple themes.

Cannot upload the image, probably a forum restriction.

Hopefully this link will show up, I grabbed a screenshot of the error message.

https://i.imgur.com/ZZZEWuq.png.

Are you using the theme as a submodule?

Yes. Unless I’ve set it up wrong.

[submodule “themes/whiteplain”]
path = themes/whiteplain
url = https://github.com/taikii/whiteplain

PS: I appreciate you taking the time to help.

I should have asked earlier - can you link to your git repository?

In config.toml try either removing the themesDir setting (I don’t think you need it since you’re using the default location) or setting it to themesDir="themes" (remove extraneous /'s).

1 Like

Tried both, did not work. Still the same errors.

There’s a problem in your theme directory. The only sub-directory in your theme is wwhiteplain, not whiteplain.

1 Like

@Ahopi

I would just remove the unnecessary settings… less things to debug. Also as @funkydan2 noted, that path is wrong… it is beginning with a “/”, which implies an absolute path. But in any case, simply removing it is better.

Add only the settings that are needed for your site to build.

So the main culprit seems to be that typo in either the actual theme dir name, or the theme name in config.

Yes there is. Right next to the message in your dashboard that the deploy failed, where you got the quote of the error messages, right there is a button that connects you right with the support.

Honestly, I have always copied the archetypes and the config.toml from the theme itself. But I did try removing it, like you suggested, but it did not work.

Thanks heaps though for all your help.

Thanks! I did just that and got some help from Chris that fixed things for me.

Thanks, I have been noticing this error with all the themes I tried.

Update - Issue sorted, thanks to support from Chris over at Netlify.

His solution was to use submodules (seemingly mine was set up incorrectly) or delete the .git subdirectory from the theme directory which would ensure the theme was uploaded. Obviously this means that I have to update the theme manually, but something I can live with right now while I’m still learning Hugo and Github.

Thanks heaps guys, for all the help.