Search code examples
javascriptnode.jsgulpdel

gulp/node `del` package buckling under large glob


I have a rather complex build process (using gulp), which builds out (among many other things) about 95 javascript files into various folders scattered throughout a build directory. I would think simply executing delete of the build folder would be straightforward, but no matter what I try, I continuously get some variation of the following error:

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

Error: ENOENT: no such file or directory, lstat '/Users/path/to/my/site/build/app/js/services/some-ever-changing-js-file.js'
    at Error (native)

Here is the extremely simple gulp task:

gulp.task('clean', '', cb => {
  del(['build'], { dryRun: false }, cb)
})

Additional Info:

  • del: ^2.2.0
  • gulp: ^3.9.0
  • If I run the task twice, it only throws the first time.
  • I have tried about every variation of file globs possible, such as build/**, build/**/*.js, build/**/*.*, always the same error, not always on the same file.
  • Tried implementing vinylPaths-- got same result :sadpanda:

Has anyone seen this behavior before? Anyone know how to fix it or what could be the cause?


Solution

  • Finally figured it out-- it had nothing to do with the build at all-- another application had this file open and it refused to delete it.