Why does `hugo new` try to update modules?

I am trying to wrap my head around something here. When I run a hugo new command it does what it does, but not without first updating the modules of my system (based on whatever rules it uses to check for updates).

I wonder, why is it important to do that at that point? Normally when running hugo new I have a site that either is running with hugo server or “recently” ran a built or deploy. Would it make sense to remove these checks at that point (new site, new post, new install)? It’s not like any updated module could influence the process of parsing an archetype file and create some content files. Is it?

Depends, I think. The archetype could be in a different module, neh?

1 Like

See, that is a hint :slight_smile: I didn’t think that archetypes could be in a module.

1 Like

Yep, any of these can be a module:

A module can be your main project or a smaller module providing one or more of the 7 component types defined in Hugo: static , content , layouts , data , assets , i18n , and archetypes .

Hugo Modules

1 Like

… but I also found the “module correctness check” to be over-eager.


In most of my own usages of hugo new all modules are up to date. I never run hugo new without NOT having the server up already. That is my pain point because the most time that whole lookup takes quite some time even if there is nothing to update.Having a way to disable that in hugo new might be good, but I am pretty sure that is not something easy to integrate.

1 Like

When I run hugo server for the first time today, I see hugo: downloading modules…, and the site build fails with an error of 2022/03/16 19:01:59 js.Build failed: after attempting to debug multiple files, I finally tried “hugo mod clean” and everything worked normally.

Like in npm packages, I’d like to have some control over the Hugo module. This random download is a disaster. I’m not sure why this download occurs at random.