Filename too long error when compiling site

As I mention in my github post here (https://github.com/gcushen/hugo-academic/issues/794), I get the following error message when I compile my site by simply running hugo:

Building sites … ERROR 2018/11/04 16:20:42 error: failed to transform resource: open /home/zdorovo/Documents/web/hugosite/themes/academic/exampleSite/public/js/mathjax-config.500a6cbb2c0f345fcecc21b3116d[redacted].js: file name too long Total in 2473 ms Error: Error building site: logged 1 error(s)

A couple of things stand out about this as weird to me:

  • I don’t get any errors when I run the command hugo server
  • Moving the directory with my website doesn’t change things. Indeed, I moved it to get the (absolute) filename down to ~180 characters. I’m using ubuntu on an ext4 partition, so as far as I can tell, my max filename length should be 255 characters. I’m still getting the error message though

I’m using the academic theme. Any help would be greatly appreciated.

Here’s what I get when I type hugo env:
Hugo Static Site Generator v0.50 linux/amd64 BuildDate: 2018-10-29T12:39:37Z
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.11.1"

Do you get the same error when running this?

hugo server --renderToDisk

Yes, I still do.

Okay good.

Can you share your site code, or create a sample repo, so that we can attempt to reproduce this locally?

Made a sample project using the exampleSite from the hugo academic theme. That same JS file giving you trouble:

/Users/betz/Development/Sites/long-filename-test/public/js/mathjax-config.500a6cbb2c0f345fcecc21b3116d6637aa78f1f11db8081ea581abe05390c2e8f3bbffe61be3cf0217baf785c40efceabe51050a4f007e69af94efd3643260e8.js

Is 205 characters for me. I’m on macOS and the sample site builds no problem.

As mentioned in the GitHub issue you linked, this is likely an issue with the OS/filesystem/configuration you are using.

@zdorovo Academic creator here. If you update to the latest master version of Academic, it should now work for you. Although the underlying issue is related to the OS/filesystem, I have reduced the length of the MathJax JS filename by removing the long Sha512 asset fingerprinting. For more details, refer to the commit at https://github.com/gcushen/hugo-academic/commit/3ea332ca673005023353dc18c3b7dd3fd4d39fac

1 Like

Thanks so much! I didn’t know where to begin fixing this filesystem issue…

Search SHA512 and replace it with “SHA256” or remove the fingerprint

layouts/partials/footer.html