niceandserious / crafty-vagrant

A boilerplate dev environment for jump-starting Craft CMS projects
MIT License
57 stars 13 forks source link

Browsersync localhost:3000 not working #20

Closed wihodges closed 8 years ago

wihodges commented 8 years ago

Can't seem to get browsersync to work from localhost:3000. The remote URL however is working: http://192.168.86.119:3000. Localhost:3000 displays site but "http://localhost:3000/browser-sync/browser-sync-client.2.11.2.js net::ERR_CONNECTION_REFUSED"

Which makes me think I might be running this wrong. 1) cd /crafty-vagrant 2) vagrant up 3) gulp watch

Should I be SSHing into the vagrant box and running gulp watch from somewhere else? Craft.dev which is set up in vhost, also does not auto reload but does render.

nickautomatic commented 8 years ago

Hi there. Firstly, you're running it exactly right, so don't worry about that (gulp watch should be run from your local machine - no need to SSH into the vagrant box).

We've only just added Browsersync and it seems there might be a few issues that need ironing out... I suspect the issue here is that our template is hard-coded to a particular version of Browsersync, and with hindsight that's probably broken when Browsersync's version changed.

I've just pushed out an updated version of package.json, with Browsersync locked to the exact version required (2.11.2 rather than ^2.11.2), so try removing Browsersync (via npm uninstall browser-sync), and then remove the ^ from Browsersync's version in package.json - ie. change it from ^2.11.2 to 2.11.2 (or alternatively, just replace your package.json with the current version that I've just pushed out). Then do npm install again and you should get the exact version of Browsersync that Crafty Vagrant currently needs. Which hopefully might get things working for you!

wihodges commented 8 years ago

Great that solved it. I think also my issue was that I ran an update to fix and my browser-sync went up to 2.11.3. Updated the hardcoded path in app/craft/templates/)_layout.twig to 2.11.3

Loving this Vagrant setup @nickautomatic - Thanks.

nickautomatic commented 8 years ago

@wihodges Excellent, glad to hear it. Incidentally, we've just pushed out a fix that avoids having to hardcode Browsersync's version, so if you want to avoid having to stick with a hardcoded version either pull in the latest changes or alternatively just remove the version number from the filename (turns out that's all that was needed!)