I think I ran into another small issue which I’m surprised I can’t find anyone talking about on Google.
I was unable to use BrowserSync due to /etc/hosts
not being in sync with Windows’ host file so when it goes to proxy
my internal host for my Trellis box, it’s unable to resolve it.
cat /mnt/c/Windows/System32/drivers/etc/hosts | grep 192.* | sudo tee -a /etc/hosts
I wrote that just now which is a dirty workaround for this. I’m sure it could be made into a script or something to be included in a ~/.bashrc
or ~/.zshrc
– but I’m more so curious on any of your guys’ take on a more sane solution?
1 thing to consider is by default, WSL’s /etc/hosts
resets it’s self to default when a new instance is made. See Issue #398 on the BashOnWindows repo.
This can be rectified by removing:
# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
at the top of the /etc/hosts
file.
Another thing to note is this has been brought up as an Issue, but doesn’t seem to of been escalated or pushed in any way. See: Issue #149.
Another small thing to watch for is:
Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false)
I was able to fix this by adding, in my case, Firefox to Windows PATH and then setting:
browser: 'firefox.exe'
in BrowserSync’s options.
Edit: Looks like this is being worked on internally.