简体   繁体   中英

gulpfile throws error events.js:154

What's listed below is throwing an error. It's my gulpfile, so I'm trying to figure it out. It's firing on events.js:154. Throw er; //Unhandled 'eerror' event.

Any idea what is wrong here? It was fine last night, it was even writing a new main.min.js file to the js folder. What is wrong and how do i get the uglifying to work again?

/* Required */
var gulp = require('gulp'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename');

/* Scripts Task */
gulp.task('scripts', function(){
    gulp.src(['app/js/**/*.js', '!app/js/**/*min.js'])
    .pipe(rename({suffix:'.min'}))
    .pipe(uglify())
    .pipe(gulp.dest('app/js'));
});

/* Watch Task */
gulp.task('watch', function(){
    gulp.watch('app/js/**/*.js', ['scripts']);
});

/* Default Task */
gulp.task('default', ['scripts', 'watch']);

First of all you don't need to execute scripts again in your default task. Its already being executed in your watch task

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM