配置 gulp-notify 后一直报错

配置文件大概为:

// 引入 gulp
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var notify = require('gulp-notify');

// JS 任务
gulp.task('scripts', function() {
    gulp.src(['src/js/*.js'])
        .pipe(concat('main.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest('dist/js'));
        .pipe(notify({ message: 'JS task complete' }));
});

// 默认任务
gulp.task('default', ['scripts']);

// 监听
gulp.watch('src/js/*.js', ['scripts']);

运行起来报错信息:

project/freegapper/gulpfile.js:25
        .pipe(notify({ message: 'JS task complete' }));
        ^

SyntaxError: Unexpected token .
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Liftoff.handleArguments (/usr/local/Cellar/nvm/0.25.4/versions/node/v5.6.0/lib/node_modules/gulp/bin/gulp.js:116:3)
    at Liftoff.<anonymous> (/usr/local/Cellar/nvm/0.25.4/versions/node/v5.6.0/lib/node_modules/gulp/node_modules/liftoff/index.js:192:16)
    at module.exports (/usr/local/Cellar/nvm/0.25.4/versions/node/v5.6.0/lib/node_modules/gulp/node_modules/flagged-respawn/index.js:17:3)

这是什么原因呢?

阅读 1.6k
评论
    1 个回答
    • 442

    多写了末尾的;了

    .pipe(gulp.dest('dist/js'));

      相似问题
      推荐文章