Support Forums

Javascript not loading, but main.js present and no JS errors on the console

Dear all,

I’m a bit at a loss here. I’ve just deployed a new site on the excellent Netlify platform. It’s based on Hugo. But the javascript doesn’t seem to load. The site can be found here: https://stoic-brown-842f62.netlify.app/. And the source is on Github: GitHub - haarts/disknotifier.com-hugo

I’m migrating from a custom-even-more-static setup which is currently live at https://disknotifier.com/.

You can see the javascript doesn’t work at, for example, the pricing toggle. I’m also using AOS (AOS - Animate on scroll library) which animates elements on scroll. These don’t work either.

The Javascript console remains empty, with no obvious errors. And the main.js is present and I think it loads properly.

I’ve tried both Firefox and Chrome and locally everything works.

What else can I try?

Thanks in advance.

I can reproduce the error when I run hugo locally and run a web server in the generated public directory (caddy file-server --listen 215).

Hi @haarts

I’ve used Chrome, Firefox, and Safari. It does not work in any.

I suggest there are no errors because no listener is called, or if it is, is not returning an error.

So it is not a Netlify-specific issue.

I’ve spent a little time digging around and cannot pinpoint anything as a/the cause.

I’ve since come to agree with you; this is not a Netlify specific issue. I can reproduce the issue when I build the site locally and start a webserver in the public directory. I’ve moved the question to that Hugo forums.

Still very odd, I’ve diff’ed the main.js and index.html and there are no differences (apart from some CSS integrity stuff). I can’t think of a difference between hugo server and hugo && cd public && caddy fileserver.