Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chokidar exits when the watched folder is removed #324

Closed
CxRes opened this issue Jul 31, 2015 · 9 comments
Closed

Chokidar exits when the watched folder is removed #324

CxRes opened this issue Jul 31, 2015 · 9 comments

Comments

@CxRes
Copy link

CxRes commented Jul 31, 2015

Given our discussion in #319 , if Chokidar is happy about placing a watch on a non-existent directory at startup, symmetry should demand that it should continue watching even if the directory is removed after issuing an unlink event (of course, assuming persistent: true). Right now, the watcher stops when the path is deleted at least on Windows.

I think the circumstances are identical in that a directory does not exist in both cases, why should they be treated differently?

@es128
Copy link
Collaborator

es128 commented Jul 31, 2015

If it's behaving this way it is a bug, not by design.

@es128 es128 added the bug label Jul 31, 2015
@quetzalcoatl
Copy link

Unfortunately, yes it does. I'm on Windows too, and I battled with some meteor/sanjo:jasmine/karma issues, and I just traced one thing down to chokidar.

Karma uses chokidar to watch its files. When Meteor's builder renames/removes a directory with those files, and then creates/renames a new directory on the same place, Karma/Chokidar stops watching this directory for file changes. I just noticed that it's the Chokidar that simply stops issuing events in this case.

@leoselig
Copy link

We are having this issue as well
Right now, we don't even have a satisfying workaround for it.

@kafoso
Copy link

kafoso commented Jun 9, 2016

This problem persists in release 1.5.2 on Windows 7 Service Pack 1.

unlinkDir event never fires. Not even when listening for all events (.on('all', ...)). Chokidar barfs this error out:

events.js:141                                            
      throw er; // Unhandled 'error' event               
      ^                                                  

Error: watch null EPERM                                  
    at exports._errnoException (util.js:874:11)          
    at FSEvent.FSWatcher._handle.onchange (fs.js:1217:21)

EDIT 2016-06-09 16:53 (CEST)

Updated npm (npm install -g npm) to newest version (2.14.7). The problem is the same.

@lkraav
Copy link

lkraav commented Sep 4, 2017

I'm also wondering whether .on( 'all' ) should or not catch error events?

@es128
Copy link
Collaborator

es128 commented Sep 5, 2017

@lkraav from the readme:

Additionally all is available which gets emitted with the underlying event name and path for every event other than ready, raw, and error.

@lkraav
Copy link

lkraav commented Sep 10, 2017

@es128 tyvm, I also happened to find this info at that time, but forgot to update the comment.

@lmoyrd
Copy link

lmoyrd commented Oct 30, 2017

when i ran script in debug mode in webstrom, it could catch error event.
but in git bash or cmd.exe (npm run dev) ,it just existed and threw the error Error watching file for changes: EPERM
Any ideas?

@quetzalcoatl
Copy link

quetzalcoatl commented Sep 6, 2018

let me try out if meterjs/karma/velocity still break on windows due to exactly this issue..
..or anything that tries observing and fiddling with delete/create at the same path :]

..but then, I don't even have them on this new machine, so that may take a while..
well, maybe 'unpopular' it really is..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants