Run Different Versions of Hugo without Installation via npx
Table of Contents
npx
lets you run different versions of Hugo without installation. To use it, install Node.js and npm at first.
Run different versions #
The syntax of npx
is npx <package-name>@<version>
. If @<version>
is not specified, the locally installed version or latest version will be used. Here are some examples:
|
|
Available versions are listed here. Oldest version is 0.63.2. If you want to use the older versions, use hugo-bin package instead. Its version doesn’t match the Hugo version, so you have to check its commit history.
|
|
Install a specific version #
You can install a specific version of Hugo in a git repository.
|
|
To change the version, run install command again.
|
|
If you clone the repository, install Hugo before using it.
|
|
Clean cache #
|
|
Note about package-lock.json #
By default, the directory name of source code will be shown in the name field in package-lock.json
. To override that, set name field in package.json
and run npm install
.
Example of package.json
:
|
|
This tutorial was tested with npm/npx v10.5.2 and Node.js v21.7.3 on Arch Linux.
Comments powered by giscus. If comments are not loaded, giscus may be blocked by your Internet service provider.
Comments powered by Disqus. If comments are not loaded, Disqus may be blocked by your Internet service provider.