1
resposta

Erros na execução

Após eu efetuar a tentativa de executar o codigo "npm run gulp build-img" apresentou esses erros abaixo:

> projeto@1.0.0 gulp C:\Users\rafael.favaro\Desktop\projeto
>gulp "build-img"

[09:03:56] Using gulpfile ~\Desktop\projeto\gulpfile.js
[09:03:56] Starting 'build-img'...
[09:04:01] gulp-imagemin: Minified 32 images (saved 181.07 kB - 8.7%)
[09:04:01] The following tasks did not complete: build-img
[09:04:01] Did you forget to signal async completion?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! projeto@1.0.0 gulp: `gulp "build-img"`
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\rafael.favaro\AppData\Roaming\npm-cache\_logs\2019-09-23T12_04_01_349Z-debug.log

...
sendo que meu js esta assim:

var gulp = require('gulp'); imagemin = require('gulp-imagemin');

gulp.task('build-img', function(){

gulp.src('src/img/**/*')
    .pipe(imagemin())
    .pipe(gulp.dest('src/img'));

});

` como solucionar esses erros?

1 resposta

Marcelo,

É provável que falte um retorno:

var gulp = require('gulp'); imagemin = require('gulp-imagemin');
gulp.task('build-img', function(){
    return gulp.src('src/img/**/*')
       .pipe(imagemin())
       .pipe(gulp.dest('src/img'));
});