Hugo not recognized

Hey, guys. Newbie question:

I started working on a site last week and got it running. Got back to it yesterday and now keep getting a “‘hugo’ is not recognized as an internal or external command, operable program or batch file.” I have the executable in c:/hugo/bin and have also tried creating a new site with the same issue. I’m obviously missing something, but can’t figure out what the deal is. I think I had issue last week, but got it working – just can’t quite recall what happened last time.

Windows 7 64-bit OS.

Thanks for any leads – really stumping me, though I’m sure it’s a simple item I’m overlooking.

Do you’ve added the path of the Hugo binary to the environment variable called path?

The path default of my command line contains the hugo folder. I was admittedly a bit confused on whether that was the correct location.

I just saw another post that said to run command line from the folder that contained the hugo.exe file. So, I ran it from the bin folder and was able to create a new site. However, last week, I ran hugo from within the actual site folder – not from the bin folder.

So, I guess it’s working now, however, I thought hugo was able to be run from any location as long as the executable is in the overall project folder.

It always works to run a binary if you are in the same directory as the binary because your operating system searches for an executable with the same name in your current location first.

Other commands like ls are also associated with a binary trough environment variables. That allows you to run them globally, even if you aren’t in the same folder as the binary. Therefore it normally should also work the same way with Hugo. But your operating system doesn’t seem to know were to find the hugo executable if you run the command hugo.

Thanks for the help. I’ll just try to work with it as-is for now and see how it goes, as it seems to work as long as I run from /bin.

Thanks again for the info.

It’s easy to add c:/hugo/bin to your system path. It has been many years since I used Windows, but it was trivial to do this in Control Panel, System, if I recall correctly. A quick search should yield a result, and it’s a 1 minute job. Then you can run hugo from anywhere.

I had issues with the install and it turned out to be the zip folder calling the file hugo_0.17_windows_amd64.exe rather than hugo.exe. I solved the problem by renaming the file to hugo.exe and launched command line from the windows directory (as I usually do): File - Open Command Line Prompt - open command prompt. Then ran hugo help to see it was now recognized. Hope this helps someone out there! Open Source FTW!

1 Like

Hi i also have same issue when i creating new website in hugo but i cant understand what is
It always works to run a binary if you are in the same directory as the binary because your operating system searches for an executable with the same name in your current location first.

here is my issue
C:\Hugo\Sites>hugo new site test
’hugo’ is not recognized as an internal or external command,
operable program or batch file.