2014-10-04 108 views
6
$ gulp patch 
[17:13:27] Requiring external module coffee-script/register 
[17:13:28] Using gulpfile ~/source/sem-campaign.js/gulpfile.coffee 
[17:13:28] Starting 'bump'... 
[17:13:28] Starting 'add'... 
[17:13:28] Bumped version to: 1.0.2 
[17:13:28] Bumped version to: 1.0.2 
[17:13:28] Finished 'bump' after 31 ms 
[17:13:28] 
[17:13:28] Finished 'add' after 30 ms 
[17:13:28] Starting 'commit'... 
[?] enter a commit msg, eg initial commit: initial commit 
[17:13:32] Finished 'commit' after 3.26 s 
[17:13:32] Starting 'patch'... 
no buddy 
[17:13:32] Finished 'patch' after 25 μs 

events.js:72 
     throw er; // Unhandled 'error' event 
      ^
Error: Command failed: 
    at ChildProcess.exithandler (child_process.js:648:15) 
    at ChildProcess.emit (events.js:98:17) 
    at maybeClose (child_process.js:756:16) 
    at Socket.<anonymous> (child_process.js:969:11) 
    at Socket.emit (events.js:95:17) 

我很難分辨出我的吞嚥任務失敗的原因以及原因。我如何增加默認堆棧跟蹤?如何增加吞噬任務的堆棧跟蹤?

+0

有一些插件,它可以幫助你:[吞掉調試(https://www.npmjs.org/package/gulp-debug)或[gulp-plumber](https://www.npmjs.org/package/gulp-plumber)顯示有關錯誤的有用信息。 – RWAM 2014-10-06 15:22:39

回答

0

添加註釋和管道工:

  1. 添加這個輔助方法:

    數=(MSG) - > 的console.log味精 #你會收到乙烯基文件作爲塊 轉換=(file,cb) - > #讀取和修改文件內容 #file.contents = new Buffer(String(file.contents)+'some modified content');

    # if there was some error, just pass as the first parameter here 
    cb(null, file); 
    

    #返回地圖會導致您的轉換函數的調用 #你收到塊(文件)中的每一個。當此流 #收到「結束」信號時,它也將結束。 # #此外,你想要求在其他地方event-stream。 return eventStream.map(transform);

  2. 管THW的任務步驟之間的日誌方法:

    gulp.task 'myTask', - > gulp.src myCss, 基地:myBase .pipe登錄 「拿到css文件!」 .pipe concat'app.css' .pipe log「concatenated css !!」

這是寫在CoffeeScript中,您可以在這裏把它轉化爲JavaScript: http://js2coffee.org/

  • 創建catch錯誤的helper方法:

    catchError = (err) - > plugins.util.beep()#ref; 的console.log犯錯

  • 添加管道工插件:

    gulp.task 'myTask', - > gulp.src myCss, 基:myBase .pipe plugins.plumber 的ErrorHandler:catchError 。管道日誌「得到的CSS文件!」 .pipe concat'app.css' .pipe log「concatenated css !!」

  • 完成! :)

    更多的資源來看看: gulp-print gulp-debug