hugo version:Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown (installed via Homebrew)hugo.
Total in 215 ms
Error: Error copying static files: EOF
Expected result:
Output resembling the following:
| EN
+------------------+----+
Pages | 13
Paginator pages | 0
Non-page files | 0
Static files | 0
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0
Total in 209 ms
This was the behavior previously observed with my test case in 0.53.0, and the behavior observed when the empty "static" directory is deleted or a file is added to it (with the addition of that blank file being notated in the list of generated files).
hugo server; namely, preventing it from running entirely. In order to get hugo server to run, either the empty "static" directory needs to be deleted or a file needs to be added to it. Interesting. I can't reproduce it neither on 0.54 nor on HEAD commit of the repo. Can you create a repo with the site that's failing to build?
Nothing significant has changed in my environment in the past few days, but I now seem to be unable to replicate this, even though I could make this trigger over and over and over just a few days ago. I'll re-open if I see it again and can provide any more information on what particular circumstances make it happen.
Appears (to me) to be an empty folder _inside of_ static.
Hugo:
Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown
My layout:
...
▶ resources
▼ static
▼ css
site.css
▼ js
▶ themes
...
As soon as I add a file to static/js Hugo renders fine. Without any files, Hugo errors:
❯ hugo
Total in 2 ms
Error: Error copying static files: EOF
Cheers.
This looks like a bug to me. Readdir in Golang returns io.EOF when a directory is empty, which I suspect is what happens here -- and it shouldn't fail.
It's strange, on my machine everything works fine. Here is the output of hugo version:
Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown
I'm using https://github.com/bep/hugotest as a test hugo site. It builds without any issues, no matter if I add an empty folder or not to static.
@themartorana, can you provide a test site that reproduces this issue?
@moorereason done! And I found a couple things along the way required to create the error:
/static and it _must have_ a matching empty folder in the theme's ./static directory! (This feels like the important bit.)
If I renamed the /static/css folder to /static/empty-test the error went away. But if I added a matching folder /themes/empty-dir-theme/static/empty-test the error came back.
Repo here: https://github.com/themartorana/hugo-empty-dir-test-site
@themartorana, excellent! 🏆
I'm able to reproduce the issue with your repo after the following:
sh$ mkdir content static themes/empty-dir-theme/static && hugo
Total in 1 ms
Error: Error copying static files: EOF
sh$ hugo env
Hugo Static Site Generator v0.55.0-DEV-908692FA linux/amd64 BuildDate: 2019-02-22T09:49:09-0600
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.11.5"
Filed upstream issue: https://github.com/spf13/afero/issues/197
Most helpful comment
@moorereason done! And I found a couple things along the way required to create the error:
/staticand it _must have_ a matching empty folder in the theme's./staticdirectory! (This feels like the important bit.)If I renamed the
/static/cssfolder to/static/empty-testthe error went away. But if I added a matching folder/themes/empty-dir-theme/static/empty-testthe error came back.Repo here: https://github.com/themartorana/hugo-empty-dir-test-site