There are a number of problems with fs.watch
, which I've been actively discussing on both the Node and CoffeeScript issue trackers. One problem—likely the one you're encountering—is that some programs save changes not by writing directly to the existing file, but rather by writing to a temporary file and then mv
-ing that file on top of the existing one. From fs.watch
's perspective, this means that the watched file has been deleted, and changes to the new file will be ignored.
On the current CoffeeScript master, we try to work around this by re-watching the file each time a rename
event is emitted. So please install that and let me know whether it solves your problem. If it doesn't, you should revert to using the older fs.watchFile
API, either by downgrading to CoffeeScript 1.1.2 or by using a third-party tool like my own Jitter.