Ao executar gulp na task 'build-img' é apresentado o seguinte erro:
curso-gulp@1.0.0 gulp C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp
> gulp "build-img"
[22:17:02] Using gulpfile ~\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\gulpfile.js
[22:17:02] Starting 'build-img'...
[22:17:02] 'build-img' errored after 26 ms
[22:17:02] TypeError: dest.on is not a function
at DestroyableTransform.Readable.pipe (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:516:8)
at Gulp.<anonymous> (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\gulpfile.js:7:6)
at module.exports (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\orchestrator\index.js:134:8)
at C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\gulp\bin\gulp.js:129:20
PS C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp> npm run gulp build-img
> curso-gulp@1.0.0 gulp C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp
> gulp "build-img"
[22:24:25] Using gulpfile ~\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\gulpfile.js
[22:24:25] Starting 'build-img'...
[22:24:25] 'build-img' errored after 15 ms
[22:24:25] TypeError: dest.on is not a function
at DestroyableTransform.Readable.pipe (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:516:8)
at Gulp.<anonymous> (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\gulpfile.js:7:6)
at module.exports (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\orchestrator\index.js:134:8)
at C:\Users\gabri\Documents\Gabriel\Code\Alura\Formacao Front End\curso-gulp\node_modules\gulp\bin\gulp.js:129:20
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! curso-gulp@1.0.0 gulp: `gulp "build-img"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the curso-gulp@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\gabri\AppData\Roaming\npm-cache\_logs\2020-01-23T01_24_26_044Z-debug.log
** Acima o erro que podemos ver é TypeError: dest.on is not a function.
**gulpfile.js
var gulp = require('gulp'),
imagemin = require('imagemin');
gulp.task('build-img', function(){
gulp.src('src/img/**/*')
.pipe(imagemin())
.pipe(gulp.dest('src/img'));
});
**packages.json
{
"name": "curso-gulp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gulp": "gulp"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-imagemin": "^2.3.0"
}
}
**versão do node: 6.11.1
Obs: Estava com a versão 12 do node, porém o erro era outro, li no forum que era indicado usar as mesmas versões utilizadas na aula, então fiz o downgrade do node, porém agora tenho esse erro.