Olá! Depois de determinar a dependência do "copy" com o "clean", e executar aparece a seguinte mensagem:
C:\Users\Usuario\Desktop\curso-gulp\projeto (projeto@1.0.0) λ npm run gulp clean
projeto@1.0.0 gulp C:\Users\Usuario\Desktop\curso-gulp\projeto gulp "clean"
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as setTask] (C:\Users\Usuario\Desktop\curso-gulp\projeto\nodemodules\undertaker\lib\set-task.js:10:3)
at Gulp.task (C:\Users\Usuario\Desktop\curso-gulp\projeto\node_modules\undertaker\lib\task.js:13:8)
at Object. (C:\Users\Usuario\Desktop\curso-gulp\projeto\gulpfile.js:6:6)
at Module.compile (internal/modules/cjs/loader.js:1236:30)
at Object.Module.extensions..js (internal/modules/cjs/loader.js:1257:10)
at Module.load (internal/modules/cjs/loader.js:1085:32)
at Function.Module.load (internal/modules/cjs/loader.js:950:14)
at Module.require (internal/modules/cjs/loader.js:1125:19)
at require (internal/modules/cjs/helpers.js:75:18)
at requireOrImport (C:\Users\Usuario\Desktop\curso-gulp\projeto\nodemodules\gulp\node_modules\gulp-cli\lib\shared\require-or-import.js:19:11) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '=='
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! projeto@1.0.0 gulp: gulp "clean"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the projeto@1.0.0 gulp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Usuario\AppData\Roaming\npm-cache_logs\2020-07-23T19_17_32_612Z-debug.log
Não entendo por que isso está acontecendo... Eis o código:
var gulp = require('gulp');
imagemin = require('gulp-imagemin');
clean = require('gulp-clean');
gulp.task('copy', ['clean'], function () {
gulp.src('src/**/*')
.pipe(gulp.dest('dist'));
})
gulp.task('clean', function () {
gulp.src('dist').pipe(clean());
})
Grato desde já