GulpUglifyError:Unable to minify JavaScript

I am trying to minify my script files for which i am using gulp task runner
And I am trying gulp-uglify plugin


  • events.js: 141 throw er; // Unhandled 'error' event
  • How can you delete a folder and its contents after all tasks have been run in Gulp?
  • Using Gulp to run Webpack + Babel, but no presets are being applied
  • How can I get the absolute path to the gulpfile?
  • Why do we need to install gulp globally and locally?
  • Gulp: run task without a destination
  •  gulp.task('concat', function() {
        return gulp.src('app/**/*.js')
            // .pipe(concat('script.js'))

    but i am getting error as

    enter image description here

    when i try to run gulp task as gulp concat
    Any help would be appreciated

  • How to debug Javascript in webstorm when gulp is serving the application
  • How to use Grunt/Gulp with pm2?
  • How to get the available tasks list in gulp
  • How to pipe input to uglify-js-harmony in gulp
  • gulp-rev with useref renaming index.html file as well
  • Why might I be getting “task completion callback called too many times” in gulp?
  • 4 Solutions collect form web for “GulpUglifyError:Unable to minify JavaScript”

    Have you used ES6 format in your script file?
    If so try ES5 now because when you do gulp-uglify it doesnt understand ES6 format as of now
    and after that try your code

     gulp.task('concat', function() {
        return gulp.src('app/**/*.js')

    and run the task gulp concat it will work

    To see the error in console:

    var gutil = require('gulp-util');
    gulp.task('concat', function() {
    return gulp.src('app/**/*.js')
        // .pipe(concat('script.js'))
        .on('error', function (err) { gutil.log('[Error]'), err.toString()); })

    To find the exact file with line no of error register and run this task:

    var pump = require('pump');
    gulp.task('uglify-error-debugging', function (cb) {
      ], cb);

    Try using this

    var concat = require('gulp-concat');
    var uglify = require('gulp-uglify');
    var minifyJS = require('gulp-minify');
    gulp.task('concat', function() {
        return gulp.src('app/**/*.js')
            .pipe(uglify({ mangle: false }))

    The main error to Unable to minifies JavaScript is the path not found. You can use the task usemin For this you need:

    $ sudo npm install gulp-usemin --save-dev
    $ sudo npm install gulp-livereload--save-dev
    $ sudo npm install gulp-util--save-dev

    and requires :

    var usemin = require('gulp-usemin');
    var livereload = require('gulp-livereload');
    var gutil = require('gulp-util'); //gutil for error display
    gulp.task('usemin',['jshint'], function(){
        return gulp.src('./app/index.html')
            css: [minifycss(),rev()],
            scripts: [uglify().on('error', function(err) {gutil.log('[Error]'), err.toString());this.emit('end');}),rev()]
    Change the js: [uglify(), rev()] to scripts: [uglify(), rev()]