hugo-bin is an npm package that wraps the Hugo static site generator, letting developers install, configure, and run Hugo binaries directly through Node.js workflows.
What is hugo-bin?
hugo-bin is a binary wrapper for Hugo, the open-source static site generator maintained by the Hugo team. It takes no site content as input; instead, it downloads the correct Hugo binary for your platform during npm install, then exposes that binary path through a JavaScript API and a command-line interface. The package is written for Node.js, distributed on npm, and maintained by Shun Sato under an MIT license. It lives in the fenneclab/hugo-bin repository.
Key Features
- Extended Hugo support — Set
buildTagstoextendedto download the Extended Hugo binary, first introduced in Hugo v0.43, which adds Sass/SCSS compilation and other features. - withdeploy support — Set
buildTagstoextended,withdeployto pull the Hugo version that bundles deploy functionality, available since Hugo v0.137.0. - Configurable download repository — Override
downloadRepoto proxy or mirror the GitHub releases, useful for corporate networks with restricted access. - Multiple configuration channels — Configure build tags, download repo, and Hugo version via the
hugo-binsection ofpackage.json, through.npmrckeys, or environment variables prefixedHUGO_BIN_. - API access — Import the package to get the binary path and run Hugo with
child_process.execFile, as shown in the README. - CLI and npm scripts — After install, run
hugo helpvianpm exec, or define scripts like "build": "hugo", "create": "hugo new", and "serve": "hugo server" inpackage.json. - Cross-platform — Works on Unix and Windows, with equivalent shell commands documented for both.
Who is it for?
- Node.js developers — Add hugo-bin as a
devDependencyto pin a Hugo version in a JavaScript project and invoke Hugo from npm scripts. - CI/CD pipelines — Use the npm-installed binary in automated builds without requiring a system-wide Hugo install.
- Developers behind corporate proxies — Point
downloadRepoto an internal Artifactory or proxy sonpm installcan fetch the binary despite network restrictions. - Sass users — Select the
extendedbuild tag to gain Hugo's built-in Sass/SCSS support without managing a separate binary.
What can you do with hugo-bin?
- Generate a static site — Run
hugothrough an npm script to compile Markdown content and themes into HTML output. - Create new posts — Use
hugo new post/my-new-post.mdvia thecreatescript to scaffold content with front matter. - Serve locally — Start the development server with
hugo serverto preview the site with live reload. - Deploy with Hugo's deploy feature — Install the
withdeployversion and use Hugo's built-in deployment commands.
How does hugo-bin work?
hugo-bin downloads the Hugo binary during the npm install step, selecting the version and build tags you configured. The downloaded binary is stored inside the package directory, and the package exports its path so Node scripts can execute it. If you change any installation option, you must reinstall hugo-bin itself, as noted in the README, so the correct binary is fetched.
FAQ
Does hugo-bin support the Extended Hugo version?
Yes. Set the buildTags option to extended. If the extended binary is not available for your platform, hugo-bin automatically falls back to the normal version.
Can I use hugo-bin behind a corporate proxy?
Yes. Set the downloadRepo option to your proxy URL, either in package.json, .npmrc, or via the HUGO_BIN_DOWNLOAD_REPO environment variable, and hugo-bin will fetch the binary from that repository.
What happens if I change hugo-bin options after install?
You need to run npm install hugo-bin again to reinstall the package, because the binary is downloaded at install time.
Is hugo-bin free?
hugo-bin is open source under the MIT license and is available on npm without charge.







