My gulpfile.js looks like this:
gulp.task('default', ['build', 'browser-sync'], function () {
gulp.watch("**/*.css", ['bs-reload']);
gulp.watch(["**/*.js", "!**/*/node_modules/**/*.*"], ['bs-reload']);
gulp.watch("**/*.html", ['bs-reload']);
});
Even though I have excluded node_modules it is trying to add a watch to all node_modules.
How can exclude it?
Please note that the node_modules does not exist at root of the project, infect it is at above the root of the project, so why it is even bother including the same?
Error: EMFILE, too many open files '/Users/**/Documents/gits/tm/node_modules/browser-sync/lib/public/socket.io.js'
at Object.fs.openSync (fs.js:438:18)
at Object.fs.readFileSync (fs.js:289:15)
at Object.utils.getSocketScript (/Users/**/Documents/gits/tm/node_modules/browser-sync/lib/snippet.js:109:19)
Try this as a more resilient drop in replacement for fs
:
Globally patch fs
like this:
var realFs = require('fs')
var gracefulFs = require('graceful-fs')
gracefulFs.gracefulify(realFs)