2015-12-08 55 views
0

我得到一個錯誤我想不出在使用gulpJs模塊一飲而盡玉Gulpjs - 吞掉玉編譯問題

> [11:13:59] TypeError: listener must be a function 
>  at DestroyableTransform.addListener (events.js:197:11) 
>  at DestroyableTransform.Readable.on (/Users/ME/Sites/temp/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:718:33) 
>  at Gulp.<anonymous> (/Users/ME/Sites/temp/gulpfile.js:14:16) 
>  at module.exports (/Users/ME/Sites/temp/node_modules/orchestrator/lib/runTask.js:34:7) 
>  at Gulp.Orchestrator._runTask (/Users/ME/Sites/temp/node_modules/orchestrator/index.js:273:3) 
>  at Gulp.Orchestrator._runStep (/Users/ME/Sites/temp/node_modules/orchestrator/index.js:214:10) 
>  at Gulp.Orchestrator.start (/Users/ME/Sites/temp/node_modules/orchestrator/index.js:134:8) 
>  at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20 
>  at doNTCallback0 (node.js:428:9) 
>  at process._tickCallback (node.js:357:13) 

我已經正確安裝了模塊和我gulpfile是:

var gulp = require('gulp'); 
var jade = require('gulp-jade'); 

gulp.task('markup', function() { 
    gulp.src('jade/**/*.jade') 
    .pipe(jade().on('error', jade.logError)) 
    .pipe(gulp.dest('/build')); 
}); 
+0

那麼'jade.logError'不是一個函數? – robertklep

回答

1

問題出現在這一行:.pipe(jade().on('error', jade.logError)) - 我相信jade不包含任何東西,如logError。嘗試這樣:.pipe(jade().on('error', console.log))

+0

正確的,通過刪除該行的作品...但我的代碼doesnt編譯爲HTML還沒有...只是把我的玉文件的副本進入/建/ – SHAMAN

+0

忘了真的.pipe(玉()):) – SHAMAN