Let’s say I have an old website that was built with an older version of Hugo.
If I install Hugo on a different PC or laptop, the official installers always installs the latest version.
Why isn’t there something like a package.json file, where a specific version of the framework is defined? With tools like npm, you can run npm install and automatically install the exact version required to run the website without surprise errors.
My main concern is if my website was built with an older version of Hugo, what happens if some methods or functions are deprecated or removed in newer versions? I might run into errors?
Technically, it would make much more sense if I could install and run a specific version of Hugo required for each site based on version control system.
The Hugo Version Manager that was linked is great, but there are a couple of other approaches worth knowing about too:
Netlify/Vercel config: If you deploy via Netlify, you can pin the Hugo version in your netlify.toml:
[build.environment]
HUGO_VERSION = "0.139.0"
This means your CI/CD always uses the right version regardless of what is installed locally.
Docker: Running Hugo in a Docker container with a pinned version tag is another solid approach for team environments. klakegg/hugo on Docker Hub has versioned tags.
GitHub Actions: If you use GitHub Pages, you can pin the version in your workflow file.
But yeah, a built-in package.json equivalent would be nice. The closest Hugo has is the module system, but that manages theme dependencies rather than the Hugo binary itself. Version pinning at the project level is something a few static site generators still have not solved neatly.