2016-11-21 90 views
1

我試圖建立我一飲而盡以觀察哈巴狗的變化,但我得到了下面的錯誤,我不知道是什麼,可以是:咕嘟咕嘟的手錶誤差

events.js:141 
     throw er; // Unhandled 'error' event 
    ^
SyntaxError: Unexpected token (19:0) 
    at Parser.pp$4.raise (/../node_modules/acorn/dist/acorn.js:2221:15) 
    at Parser.pp.unexpected (/../node_modules/acorn/dist/acorn.js:603:10) 
    at Parser.pp$3.parseExprAtom (/../node_modules/acorn/dist/acorn.js:1822:12) 
    at Parser.pp$3.parseExprSubscripts (/../node_modules/acorn/dist/acorn.js:1715:21) 
    at Parser.pp$3.parseMaybeUnary (/../node_modules/acorn/dist/acorn.js:1692:19) 
    at Parser.pp$3.parseExprOps (/../node_modules/acorn/dist/acorn.js:1637:21) 
    at Parser.pp$3.parseMaybeConditional (/../node_modules/acorn/dist/acorn.js:1620:21) 
    at Parser.pp$3.parseMaybeAssign (/../node_modules/acorn/dist/acorn.js:1597:21) 
    at Parser.pp$1.parseVar (/../node_modules/acorn/dist/acorn.js:1034:28) 
    at Parser.pp$1.parseVarStatement (/../node_modules/acorn/dist/acorn.js:917:10) 

我gulpfile .js看起來像這樣:

const gulp = require('gulp'); 
const pug = require('gulp-pug');  

gulp.task('pug',() => 
    gulp.src('pug/*.pug') 
    .pipe(pug({ pretty: false })) 
    .pipe(gulp.dest('.'))  
); 

gulp.task('watch', function(){ 
    gulp.watch('pug/*.pug', ['pug']); 
}); 
+0

哪一行是141?你有那個文件夾(至少有一個帕格文件)? –

回答

0

問題可能是.pipe(gulp.dest('.'))您應該指定一個實際的文件夾名稱。例如.pipe(gulp.dest('folderName'))/ .pipe(gulp.dest([__dirname])

另外添加一個return語句gulp.src('pug/*.pug') 所以它看起來像

return gulp.src('pug/*.pug')它避免了與包括一個return聲明的錯誤。

你能修改你的問題來包括你的帕格文件嗎?