Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

npm run gulp build-img com erro

Fiz todos os passos e quando vou rodar o buid-img apresenta o seguinte erro. O que pode ser? abrcs

projeto2@1.0.0 gulp /Users/thiago/Desktop/projeto2
> gulp "build-img"

/Users/thiago/Desktop/projeto2/gulpfile.js:1
(function (exports, require, module, __filename, __dirname) { var gulp = required('gulp'),
                                                                         ^

ReferenceError: required is not defined
    at Object.<anonymous> (/Users/thiago/Desktop/projeto2/gulpfile.js:1:74)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Liftoff.handleArguments (/Users/thiago/Desktop/projeto2/node_modules/gulp/bin/gulp.js:116:3)
    at Liftoff.<anonymous> (/Users/thiago/Desktop/projeto2/node_modules/gulp/node_modules/liftoff/index.js:198:16)
    at module.exports (/Users/thiago/Desktop/projeto2/node_modules/gulp/node_modules/liftoff/node_modules/flagged-respawn/index.js:17:3)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "gulp" "build-img"
npm ERR! node v4.4.3
npm ERR! npm  v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! projeto2@1.0.0 gulp: `gulp "build-img"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the projeto2@1.0.0 gulp script 'gulp "build-img"'.
npm ERR! This is most likely a problem with the projeto2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp "build-img"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs projeto2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls projeto2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/thiago/Desktop/projeto2/npm-debug.log
4 respostas
solução!

Olá, Thiago. Você pode me mandar o seu package.json?

var gulp = required('gulp'),
    imagemin = required('gulp-imagemin');


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

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

});

Olá, resolvido!

Erro de sintaxe no package.json.

Obrigado!

Muito bom, Thiago :-)