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

Error: watch EINVAL #629

Closed
dukhevych opened this issue Sep 13, 2015 · 10 comments
Closed

Error: watch EINVAL #629

dukhevych opened this issue Sep 13, 2015 · 10 comments

Comments

@dukhevych
Copy link

Hello. I am beginner and just got a strange error.
I have test.js with one line:

console.log(1);
$ nodemon test.js
13 Sep 23:00:59 - [nodemon] v1.5.0
13 Sep 23:00:59 - [nodemon] to restart at any time, enter `rs`
13 Sep 23:00:59 - [nodemon] watching: *.*
13 Sep 23:00:59 - [nodemon] starting `node test.js`
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: watch EINVAL
at exports._errnoException (util.js:746:11)
at FSWatcher.start (fs.js:1172:11)
at Object.fs.watch (fs.js:1198:11)
at createFsWatchInstance (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:37:15)
at setFsWatchListener (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:80:15)
at EventEmitter.NodeFsHandler._watchWithNodeFs (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:228:14)
at EventEmitter.NodeFsHandler._handleFile (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:255:21)
at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:468:21)
at FSReqWrap.oncomplete (fs.js:95:15)

Node -v0.12.3
NPM 3.2.2

What's wrong with nodefs-handler.js?

@dukhevych dukhevych changed the title error: Error: watch EINVAL Sep 13, 2015
@remy
Copy link
Owner

remy commented Sep 13, 2015

Can you re-run but add an environment variable of DEBUG=nodemon and paste
the output here (I don't know how you set env values on windows, but if
you're using something like the git shell, just put that statement in front
of the nodemon command).

On Sun, 13 Sep 2015 21:40 Bogdan notifications@github.com wrote:

Hello. I am beginner and just got a strange error.
I have test.js with one line:

console.log(1);

$ nodemon test.js
13 Sep 23:00:59 - [nodemon] v1.5.0
13 Sep 23:00:59 - [nodemon] to restart at any time, enter rs
13 Sep 23:00:59 - [nodemon] watching: .
13 Sep 23:00:59 - [nodemon] starting node test.js
events.js:85
throw er; // Unhandled 'error' event
^
Error: watch EINVAL
at exports._errnoException (util.js:746:11)
at FSWatcher.start (fs.js:1172:11)
at Object.fs.watch (fs.js:1198:11)
at createFsWatchInstance (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:37:15)
at setFsWatchListener (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:80:15)
at EventEmitter.NodeFsHandler._watchWithNodeFs (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:228:14)
at EventEmitter.NodeFsHandler._handleFile (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:255:21)
at EventEmitter. (C:\Program Files\nodejs\node_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:468:21)
at FSReqWrap.oncomplete (fs.js:95:15)

Node -v0.12.3
NPM 3.2.2

What's wrong with nodefs-handler.js?


Reply to this email directly or view it on GitHub
#629.

@dukhevych
Copy link
Author

@remy Did you mean --debug flag? If yes, then output is the same as above.

@remy
Copy link
Owner

remy commented Sep 14, 2015

No, I didn't meant the debug flag, I meant exactly as I said above. It'll
yield further debug to help diagnose the issue.

On Sun, 13 Sep 2015 23:15 Bogdan notifications@github.com wrote:

@remy https://github.com/remy Did you mean --debug flag? If yes, then
output is the same as above.


Reply to this email directly or view it on GitHub
#629 (comment).

@dukhevych
Copy link
Author

$ NODE_ENV=debug

$ nodemon test.js
  nodemon bus new listener: reset (0) +0ms
  nodemon bus new listener: reset (0) +4ms
  nodemon bus new listener: quit (0) +11ms
  nodemon bus new listener: quit (0) +0ms
  nodemon bus new listener: restart (0) +1ms
  nodemon bus new listener: restart (0) +0ms
  nodemon bus new listener: reset (2) +6ms
  nodemon bus emit: reset +2ms
  nodemon reset +1ms
  nodemon final rules +168ms { ignore:
   [ '.git',
     'node_modules',
     'bower_components',
     '.sass-cache',
     re: /\.git|node_modules|bower_components|\.sass\-cache/ ],
  watch: [ '*.*', re: /.*\..*/ ],
  restartable: 'rs',
  execMap: { py: 'python', rb: 'ruby' },
  stdin: true,
  runOnChangeOnly: false,
  verbose: false,
  stdout: true,
  execOptions:
   { script: 'test.js',
     exec: 'node',
     args: [],
     scriptPosition: 0,
     nodeArgs: undefined,
     ext: 'js',
     env: {},
     execArgs: [] } }
  nodemon config: dirs +6ms [ 'd:\\' ]
14 Sep 10:52:01 - [nodemon] v1.5.0
14 Sep 10:52:01 - [nodemon] to restart at any time, enter `rs`
14 Sep 10:52:01 - [nodemon] watching: *.*
14 Sep 10:52:01 - [nodemon] starting `node test.js`
  nodemon bus new listener: exit (0) +9ms
  nodemon bus new listener: exit (0) +1ms
  nodemon about to watch +0ms
  nodemon start watch on: d:\ +1ms
  nodemon ignore dirs regex(/\.git|node_modules|bower_components|\.sass\-cache/)
 +0ms
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: watch EINVAL
    at exports._errnoException (util.js:746:11)
    at FSWatcher.start (fs.js:1172:11)
    at Object.fs.watch (fs.js:1198:11)
    at createFsWatchInstance (c:\Program Files\nodejs\node_modules\nodemon\node_
modules\chokidar\lib\nodefs-handler.js:37:15)
    at setFsWatchListener (c:\Program Files\nodejs\node_modules\nodemon\node_mod
ules\chokidar\lib\nodefs-handler.js:80:15)
    at EventEmitter.NodeFsHandler._watchWithNodeFs (c:\Program Files\nodejs\node
_modules\nodemon\node_modules\chokidar\lib\nodefs-handler.js:228:14)
    at EventEmitter.NodeFsHandler._handleFile (c:\Program Files\nodejs\node_modu
les\nodemon\node_modules\chokidar\lib\nodefs-handler.js:255:21)
    at EventEmitter.<anonymous> (c:\Program Files\nodejs\node_modules\nodemon\no
de_modules\chokidar\lib\nodefs-handler.js:468:21)
    at FSReqWrap.oncomplete (fs.js:95:15)

@remy
Copy link
Owner

remy commented Sep 14, 2015

Oh, sorry, can you use DEBUG=nodemon,nodemon:watch and repeat?

Sorry, I forgot I filtered out the super-detail to nodemon:watch.

@dukhevych
Copy link
Author

@remy
I moved test.js to a separate folder and the error dissappeared.
Do siblings of the specified file affect the nodemon? There were some folders and files.

@remy
Copy link
Owner

remy commented Sep 14, 2015

I suspect you were hitting an internal limit in Chokidar (the 3rd party module that does the monitoring). Linked to this: paulmillr/chokidar#229

@remy
Copy link
Owner

remy commented Sep 14, 2015

I've now spotted that you were running from the root directory, so this explains that it was trying to read every js file on your d:\ drive. I think there's two action points (for the nodemon project here):

  1. Handle the Error: watch EINVAL to offer a useful message
  2. Maybe check to see if we're working from a root of a drive, and if so, only monitor the file given, and not directories.

@remy
Copy link
Owner

remy commented Sep 19, 2015

Fixed in 1.6.0

@remy remy closed this as completed Sep 19, 2015
@remy
Copy link
Owner

remy commented Sep 19, 2015

Well...not fixed, it just echos a real (useful) error message.

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

2 participants