del: Gulp task problem with del

Sincerely, I’m not so sure if this error is from this package or gulp. But you can help me. When I call my gulp task clean

gulp.task('clean', cb => {
  del(['.tmp', 'dist/*', '!dist/.git'], {dot: true}).then(cb);
});

I get this:

[01:28:16] Requiring external module babel-core/register
[01:30:33] Using gulpfile d:\www\web-starter-kit\gulpfile.babel.js
[01:30:33] Starting 'clean'...
[01:30:34] 'clean' errored after 325 ms
[01:30:34] Error
    at formatError (C:\Users\ramasilveyra\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:169:10)
    at Gulp.<anonymous> (C:\Users\ramasilveyra\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:195:15)
    at emitOne (events.js:77:13)
    at Gulp.emit (events.js:169:7)
    at Gulp.Orchestrator._emitTaskDone (d:\www\web-starter-kit\node_modules\gulp\node_modules\orchestrator\index.js:264:8)
    at d:\www\web-starter-kit\node_modules\gulp\node_modules\orchestrator\index.js:275:23
    at finish (d:\www\web-starter-kit\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:21:8)
    at cb (d:\www\web-starter-kit\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:29:3)

Maybe a problem with the promise?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

I’m using it this way (with gulp 4) and the task is run in series, e.g.:

function clean() {
  return del(destination);
}

gulp.task('build', gulp.series(
  clean,
  gulp.parallel(
    buildStatic,
    buildAppJs, buildAppScss,
    buildVendorJs, buildVendorCss
  ),
  buildIndex
));
gulp.task('default', gulp.series(
  gulp.parallel('lint', 'test'), 'build', gulp.parallel('watch', 'start')
));

However, since I adopted this new API I keep getting the following error when I first run the task (running it a second time after it causes no problems):

[11:01:27] Starting 'clean'...
[11:01:27] 'clean' errored after 37 ms
[11:01:27] Error: ENOTEMPTY: directory not empty, rmdir '/Users/Adam/Sites/some-site/public'
  at Error (native)

Any thoughts? Needless to say that the test & lint tasks don’t interact with the public folder at all, so I’m not sure why this error is thrown.