Does anyone have any tips for installing and using Hugo in BashOnWindows, which is also known as Windows Subsystem for Linux (WSL)? I want to do this because then I’ll be able to have the same setup and use the same commands on my Windows and OSX machines, and when I ssh to my web-hosting provider (DreamHost). I’ll also be able to use nix symlinks on Windows .
I’m pretty sure you would have to build it yourself – whether it will work or not depends mainly on how mature/finished the Windows subsystem is. I’ve seen some discussion over at the Go issue tracker.
But try; Hugo should in its core be pretty straight forward, but the watcher/reload part is heavy on syscalls, so that could be interesting re. bash on Windows.
I suggest you just try it and report back any issues.
I was not able to get hugo server working out of the box, or working at all. I do not have AV installed, only Windows Defender. Running latest Windows 10 (2018/04/26).
I opened TCP/1313 in windows firewall inbound, but that did not help. netstat from CMD did not reveal 1313 port was open. Even opening one WSL window with hugo server running, I cannot curl to localhost:1313 from another WSL window.
I also tried setting --bind 0.0.0.0 but that did not change anything.
Any suggestions on getting hugo server working on windows subsystem for linux?
Have you tried simply installing the Ubuntu packaged version? It should be available. The default installation of WSL is Ubuntu without a GUI. You can, if you prefer, use one of the other distro versions from the store.
Hi, they claim this port problem is a general problem in wsl.exe.
Generally, 0.0.0.0 means “all IP addresses on this box” so, that approach might be problematic in that, it’ll try binding some IP that has that port range blocked (wild speculation), though I have not tested. I’d leave that off, because hugo server defaults to binding port 1313 to 127.0.0.1.
What hugo server command exactly are you running? Did you get any hints in the log from the --verbose switch?
Did you try netstat -an?
Did you try hitting the problem with a big hammer and just allowing all traffic to and from the wsl.exe program itself and not just the port?
Hi there … I just went through this myself and hugo with WSL on windows is working great … super fast … plus running build scripts like gulp , npm work smoothly. I cant speak to your specific issue but you need to get WSL working first. I had some wierd issues with the windows store and had to do rebuild windows / reinstall and then select ubuntu. I just put the prebuilt binary in the path location for Hugo and it is working out of the box. maybe try ubuntu ?
one of the comments from the microsoft bug report said
Tried all your solutions but failed.
Reset windows and reinstall ubuntu from windows store saved my time.
test from PC browser -> get the expected blank page, no 404’s
All working. Tried on the default 1313 port and on a couple of random alternative ports.
Incidentally, I couldn’t get snap to work under WSL. But I’ve never used it before and I didn’t really try, it just didn’t work first time when I installed it so I removed it again and used the downloaded deb instead.
This is actually a case where working under Windows is actually rather easier than doing things in Linux.