Error Creating New Site Windows 10

I’m a new Hugo user and have searched the forums for this error, but I’ve only seen posts for Ubuntu or OSX.

I’ve installed hugo at c:\Hugo\bin and added it to the path. When I try to create a new site I receive an error that it can’t create the directory. I’ve tried running CMD.exe and powershell as administrator but keep getting the same error. I’ve even gone into the properties of hugo.exe and checked to always run as administrator with no luck. Any ideas?

I’ve tried creating a site with the full path from c:\Hugo\bin and also from my project working directory

I’ve also deleted the exe file, removed from the path. Rebooted and installed with chocolatey and still getting the same errors.

I’ve also created a directory in file explorer and tried to initialize within the directory. It’s saying it is not a directory

Try doing it all outside of Onedrive.

Can’t be sure but I remember some odd behaviour with something inside either onedrive or Googledrive. Sorry I can’t be more specific as it was a long time ago, and not sure it was even Hugo related (if it wasn’t it was for something similar). But I have a niggling feeling this may be your problem.

I’ll give it a shot and report back. Thanks.

So here is something interesting I found out. Before I left my office to head to the airport I installed the Windows Subsystem for Linux Ubuntu distro and the installed Hugo with apt-get. Just for giggles I figured I’d try to create a new site in my OneDrive folder. Using Bash and in /mnt/c/users/barnejoh/OneDrive/Git-VSTS I was successfully able to create a new site.

Not sure what the issue is with OneDrive and Hugo in Windows, but it works with the same folder in WSL.

Thanks for the pointer though about OneDrive.


The Hugo version in apt is old and not recommended. If you rely on it you will see errors sooner or later.

Not sure if WSL allows snaps, if it does then try using the Hugo snap.

Snapd is not available:

Doesn’t look like WSL allows snaps. :slightly_frowning_face:

WSL is something like chroot so it’s kind of limited.

If you really have to use One Drive for your Hugo project try running a lightweight Lubuntu or Xubuntu 16.04 Virtual Machine and mount One Drive as a shared folder.

If you go for this set up only the Hugo binary will do. The Hugo snap cannot access the VM shared folder because of limitations with the snap architecture.

I ended up just moving it out of the OneDrive directory. I figure it would be easier to follow the KISS principle instead of adding in any more complexity of a VM. Thanks for the guidance.