Gulp task does not work

0

I'm studying Gulp and for testing I did like this:

var gulp = require("gulp")
var html = require("gulp-htmlmin");
var imagemin = require("imagemin");

gulp.task("default",function(){
      gulp.src('.src/img/*.jpg').pipe(imagemin()).pipe( gulp.dest('./dist/') );
      gulp.src('./src/index.html').pipe(html({collapseWhitespace:true})).pipe( 
gulp.dest('./dist/') );
 return 

});

But it does not work, you're giving this error here:

[22:53:43] Using gulpfile ~\Desktop\testeGulp\teste2\gulpfile.js
[22:53:43] Starting 'default'...
[22:53:43] 'default' errored after 9.84 ms
[22:53:43] TypeError: dest.on is not a function
    at DestroyableTransform.Readable.pipe (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:516:8)
    at Gulp.<anonymous> (C:\Users\lante\Desktop\testeGulp\teste2\gulpfile.js:6:33)
    at module.exports (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\orchestrator\index.js:214:10)
    at Gulp.Orchestrator.start (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\orchestrator\index.js:134:8)
    at C:\Users\lante\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20
    at process._tickCallback (internal/process/next_tick.js:61:11)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
(node:8452) UnhandledPromiseRejectionWarning: TypeError: Expected an 'Array', got 'undefined'
    at module.exports (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\imagemin\index.js:47:25)
    at Gulp.<anonymous> (C:\Users\lante\Desktop\testeGulp\teste2\gulpfile.js:6:38)
    at module.exports (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\orchestrator\index.js:214:10)
    at Gulp.Orchestrator.start (C:\Users\lante\Desktop\testeGulp\teste2\node_modules\orchestrator\index.js:134:8)
    at C:\Users\lante\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20
    at process._tickCallback (internal/process/next_tick.js:61:11)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
(node:8452) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async
function without a catch block, or by rejecting a promise which was
not handled with .catch(). (rejection id: 1)
(node:8452) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are
not handled will terminate the Node.js process with a non-zero exit code.
    
asked by anonymous 19.11.2018 / 01:59

0 answers