$ ulimit -n 2048
Detailed info: http://otaqui.com/blog/1618/how-to-fix-error-emfile-too-many-open-files-from-yeoman-and-npm/
It happened to me when issued a brunch watch command from iTerm after doing it on RubyMine (w/ custom build command using brunch executable):
$ brunch w -s
10 Mar 08:17:55 - info: application started on http://localhost:3333/
path.js:309
var path = (i >= 0) ? arguments[i] : process.cwd();
^
Error: EMFILE, too many open files
at Object.exports.resolve (path.js:309:52)
at Object.realpath (fs.js:1309:18)
at FSWatcher.exports.FSWatcher.FSWatcher._handle (/usr/local/share/npm/lib/node_modules/brunch/node_modules/chokidar/lib/index.js:209:17)
at FSWatcher._handle (/usr/local/share/npm/lib/node_modules/brunch/node_modules/chokidar/lib/index.js:6:61)
at /usr/local/share/npm/lib/node_modules/brunch/node_modules/chokidar/lib/index.js:193:26
at Array.forEach (native)
at /usr/local/share/npm/lib/node_modules/brunch/node_modules/chokidar/lib/index.js:192:14
at Object.oncomplete (fs.js:107:15)