webxl / grunt-reload

A grunt task and reverse proxy that enables live reloading of updated files in the browser.
MIT License
132 stars 19 forks source link

[Grunt 0.4] reload task launch server each time & do not trigger refresh #13

Closed MoOx closed 9 years ago

MoOx commented 11 years ago

I've just started a new project with grunt 0.4a, & like the doc said, I run reload before watch (to start server) & reload each time my CSS change, but the 2nd reload, instead of trigger the refresh, just try to start a new server (error: Fatal error: listen EADDRINUSE). I made some uggly debbuging & it seems that servers are not properly stored in the var servers. Can this be a variable scope issue comming up with grunt 0.4 ? Or maybe a problem with server.defaultsyntax (default is a reserved keyword for the switch) ?

MoOx commented 11 years ago

it seems the tasks/reload.js is relaunched each time the since grunt 0.4, (it does not with 0.3.x), so the servers list is overwritten each time. Weird :panda_face:

iclanzan commented 11 years ago

I can confirm this bug also.

christiansmith commented 11 years ago

+1

srigi commented 11 years ago

same problem here

Fatal error: listen EADDRINUSE

manuel-woelker commented 11 years ago

A short term fix might be to connect to the (already running) server first, triggering the reload event via a get on a certain URL (/triggerReload?). I might take a stab at this.

ericclemmons commented 11 years ago

Man, this sucks. Have a project on grunt 0.4 and having the same error. Would it be possible to just kill the previously-existing server so it doesn't have this error on reload or no?

shama commented 11 years ago

@manuel-woelker please send a pull request with that change. Excellent solution that works beautifully with the latest grunt-contrib-watch. You are my hero. :D

SpeCT commented 11 years ago

For those who is still experiencing same problems and found this page just like I did.

Try to install npm package directly from GitHub instead of using npm repo.

npm install git://github.com/webxl/grunt-reload.git --save-dev

This suggestion is reasonable until @webxl didn't npm-published latest version. (see npm version is 0.2, but current master branch is already 0.4).

ericclemmons commented 11 years ago

Ah! Thanks @SpeCT!

MoOx commented 9 years ago

Closing due to inactivity