Boa tarde pessoal.
Estou rodando o gulp é esta aparecendo o seguinte erro:
stream.js:74 throw er; // Unhandled stream error in pipe. ^ GulpUglifyError: unable to minify JavaScript
Já pesquisei sobre esse erro mas não consegui resolver.
Boa tarde pessoal.
Estou rodando o gulp é esta aparecendo o seguinte erro:
stream.js:74 throw er; // Unhandled stream error in pipe. ^ GulpUglifyError: unable to minify JavaScript
Já pesquisei sobre esse erro mas não consegui resolver.
Me parece instalação problemática, já tentou reinstalar o uglify?
Vou reinstalar.
reinstalei mas continua com o mesmo erro.
O mesmo erro? Você pode postar aqui o gulpfile.js pra gente ver o que pode ser?
Segue meu gulpfile.js:
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var usemin = require('gulp-usemin');
var cssmin = require('gulp-cssmin');
var browserSync = require('browser-sync');
var jshint = require('gulp-jshint');
var jshintStylish = require('jshint-stylish');
var csslint = require('gulp-csslint');
var autoPrefixer = require('gulp-autoprefixer');
var less = require('gulp-less');
gulp.task('default', ['copy'], function(){
gulp.start('build-img', 'usemin');
});
gulp.task('copy', ['clean'], function(){
return gulp.src('site/**/*')
.pipe(gulp.dest('dist'));
});
gulp.task('clean', function(){
return gulp.src('dist')
.pipe(clean());
});
gulp.task('build-img', function(){
gulp.src('dist/images/**/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/images'));
});
gulp.task('usemin', function(){
gulp.src('dist/**/*.html')
.pipe(usemin({
'js': [uglify],
'css': [autoPrefixer, cssmin]
}))['transform-runtime']}))
.pipe(gulp.dest('dist'));
});
gulp.task('server', function(){
browserSync.init({
server: {
baseDir: 'src'
}
});
gulp.watch('site/js/*.js').on('change', function(event){
gulp.src(event.path)
.pipe(jshint())
.pipe(jshint.reporter(jshintStylish));
});
gulp.watch('site/css/*.css').on('change', function(event){
gulp.src(event.path)
.pipe(csslint())
.pipe(csslint.reporter());
});
gulp.watch('site/**/*').on('change', browserSync.reload);
});
Erro que esta dando ao executar o npm run gulp:
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error
at new JS_Parse_Error (/var/www/empresa/node_modules/uglify-js/lib/parse.js:196:18)
at js_error (/var/www/empresa/node_modules/uglify-js/lib/parse.js:204:11)
at croak (/var/www/empresa/node_modules/uglify-js/lib/parse.js:684:41)
at token_error (/var/www/empresa/node_modules/uglify-js/lib/parse.js:688:9)
at expect_token (/var/www/empresa/node_modules/uglify-js/lib/parse.js:701:9)
at expect (/var/www/empresa/node_modules/uglify-js/lib/parse.js:704:36)
at maybe_conditional (/var/www/empresa/node_modules/uglify-js/lib/parse.js:1407:13)
at maybe_assign (/var/www/empresa/node_modules/uglify-js/lib/parse.js:1427:20)
at expression (/var/www/empresa/node_modules/uglify-js/lib/parse.js:1446:20)
at maybe_conditional (/var/www/empresa/node_modules/uglify-js/lib/parse.js:1412:31)
at maybe_assign (/var/www/empresa/node_modules/uglify-js/lib/parse.js:1427:20)
at expression (/var/www/empresa/node_modules/uglify-js/lib/parse.js:1446:20)
npm ERR! Linux 3.13.0-103-generic
npm ERR! argv "/home/gustavo/.nvm/versions/node/v0.12.17/bin/node" "/home/gustavo/.nvm/versions/node/v0.12.17/bin/npm" "run" "gulp"
npm ERR! node v0.12.17
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! projeto@1.0.0 gulp: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the projeto@1.0.0 gulp script 'gulp'.
npm ERR! This is most likely a problem with the projeto package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs projeto
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls projeto
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/empresa/npm-debug.log
Gustavo,
Tente chamar o uglify, autoprefixer e cssmin como função, dessa maneira:
gulp.task('usemin', function(){
gulp.src('dist/**/*.html')
.pipe(usemin({
'js': [uglify()],
'css': [autoPrefixer(), cssmin()]
}))['transform-runtime']}))
.pipe(gulp.dest('dist'));
});
Abs!