nodemon: [nodemon] Internal watch failed: watch EMFILE

Not sure what’s prompted this, since the same operation was working fine a few days ago. I’ve rebooted to no effect, so presumably it’s not ye olde too-many-open-files problem.

$ nodemon --debug --dump server.js
[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
--------------
node: v0.10.26
nodemon: 1.8.1
command: node /Users/rcoupe/.nvm/v0.10.26/bin/nodemon --debug --dump server.js
cwd: /Users/rcoupe/Code/overlay-management-system
OS: darwin x64
--------------
{ run: false,
  system: { cwd: '/Users/rcoupe/Code/overlay-management-system' },
  required: false,
  dirs: [ '/Users/rcoupe/Code/overlay-management-system' ],
  timeout: 1000,
  options:
   { dump: true,
     ignore:
      [ '.git',
        'node_modules',
        'bower_components',
        '.sass-cache',
        re: /\.git|node_modules|bower_components|\.sass\-cache/ ],
     watch: [ '*.*', re: /.*\..*/ ],
     ignoreRoot: [ '.git', 'node_modules', 'bower_components', '.sass-cache' ],
     restartable: 'rs',
     colours: true,
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     runOnChangeOnly: false,
     verbose: false,
     stdout: true,
     execOptions:
      { script: 'server.js',
        exec: 'node',
        args: [ '--debug' ],
        scriptPosition: 1,
        nodeArgs: undefined,
        ext: 'js,json',
        env: {},
        execArgs: [] },
     monitor:
      [ '*.*',
        '!/Users/rcoupe/Code/overlay-management-system/.git/**/*',
        '!/Users/rcoupe/Code/overlay-management-system/node_modules/**/*',
        '!bower_components',
        '!.sass-cache' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  command:
   { raw: { executable: 'node', args: [ '--debug', 'server.js' ] },
     string: 'node --debug server.js' } }
--------------

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 26 (1 by maintainers)

Most upvoted comments

Try to use --watch “./directory”. For me it worked

just run this to changed max_user_watchs--------->echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Even i had the same error:

[nodemon] Internal watch failed: EMFILE: too many open files, watch

I fixed it by just uninstalling and reinstalling nodemon:

npm uninstall -g nodemon; npm install -g nodemon

Hope this works for you guys as well 👍

In my case,

Error: [nodemon] Internal watch failed: EMFILE: too many open files, watch

Solution:

  1. I close the vs code,
  2. Reopen it, and solve the problem.

Run this command

echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

killall -9 node resolve this problem

Did anyone find a fix for the EPERM issue that occurs in the Windows 10 Bash?

I solved it on my mac by deleting the node_modules and re-installing nodemon again through it not use it globally; worked normally after that.

i got error

sysctl: illegal option -- p
usage: sysctl [-bdehiNnoqx] name[=value] ...
       sysctl [-bdehNnoqx] -a

You can try --ignore node_modules

I’m seeing this issue consistently on the new Windows Subsystem for Linux.

This does not appear to be a problem with supervisor, btw.

@Carpetfizz For me it was the current path was not including the script I was running:

$ cd /
$ nodemon /tmp/myproject/bin/myproject.js

FIxed it with a cd to the folder containing the main script

Note: I use Ubuntu.

@djensen47 actually the error (at least for me) on Windows Ubuntu shell is EPERM and not EMFILE which is discussed here.

I had this same problem and I fixed it by updating my version of NPM and Node.

For me closing and reopening the VS code worked too.

I run nodemon through screen and when this happened to me I fixed it by killing the screen session and starting a new one.