Initializing your Hugo project with the module feature. You can do this by running hugo mod init github.com/username/reponame in your project directory.
If you wish to see the contents of your module within your project, you can make use of Hugo's hugo mod vendor command. It creates a vendor directory at the root of your project, and copies all module files into it. This is mostly used for debugging, or if you wish to make sure that all your dependencies are within your project directory. Remember to include the /vendor directory in your .gitignore file if you choose to use this, as it's not normally recommended to commit vendored dependencies to your repository.
-
Re-Initialize Your Hugo Project: Try re-initializing your Hugo project with the module feature. You can do this by running
hugo mod init github.com/username/reponamein your project directory. -
Check your Go version: Hugo Modules are built on top of Go Modules, which requires Go 1.11 or higher. You can check your Go version by running
go versionin your terminal. -
Manually Add Module to Go: You can try adding the module manually to Go's module list by running
go get github.com/username/repo/in your terminal. Note that this command requires the Go language to be installed on your machine. -
Check
GOPATHandGO111MODULE: Go's environment variables could also play a part in this issue. You can try printing their values withecho $GOPATHandecho $GO111MODULErespectively. IfGO111MODULEis set tooff, try setting it toonorautousingexport GO111MODULE=on.