Chrome can't open localhost:3000 with Gulp / BrowserSync
I figured out the issue if this helps anybody.
Accessing the site through the public IP that BrowserSync gives worked, but I still needed localhost:3000
, so I investigated further into the hosts file on Mac.
By default it seems this line was the one affecting the connection:
::1 localhost
All you have to do is comment this line out and all should be fine:
#::1 localhost
Hope this helps someone with a similar issue using Gulp and BrowserSync with Chrome on a Mac.
I have had this problem for weeks! I finally figured out the direct combination to resolve this on: Mac Sierra 10.12.6.
Indeed, the answer above with the most points, is correct. However, i found i had to flush my DNS Cache directly after updating my host file, otherwise i would continue to get the white screen of death - DNS caching was my issue :/
Here are the steps that finally resolved this for me:
1.Disconnect any existing gulp servers (and in my case VPN connections that affiliate with the server you are trying to proxy)
2.In your 'hosts' file:
change
::1 localhost
to
#::1 localhost
then save that file
3.Open 'Terminal'
4.Copy / paste this into Terminal, then hit enter(these commands flush your DNS cache)
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;
5.Reconnect to VPN (if any), re-run your gulp browsersync command
And voila! You should be able to get past the white screen, and the forever spinning browser wheel.
I have similar problems before, I tried these combinations, sometimes just changing the paths helps.
gulp.task('browser-sync',['nodemon'], function() { browserSync.init(null, { // proxy:"http://localhost:3000" //server: "./server/app.js" proxy:"localhost:3001" });});