2015-09-08 53 views
0

我的gulp文件出現錯誤。有誰能夠幫助我?gulp.run()已被棄用。使用任務依賴關係或gulp.watch任務觸發

它以前工作。但是在我添加了gulp-watch插件之後,它崩潰了。

那麼我需要使用什麼?

這是我的Gulpfile.js

這裏是一個日誌:

[email protected]:~/git/lasttest$ gulp 
[18:01:25] Using gulpfile ~/git/lasttest/gulpfile.js 
[18:01:25] Starting 'default'... 
gulp.run() has been deprecated. Use task dependencies or gulp.watch task triggering instead. 
[18:01:25] Starting 'server'... 
[18:01:25] Finished 'server' after 18 ms 
[18:01:25] Finished 'default' after 37 ms 
events.js:85 
    throw er; // Unhandled 'error' event 
     ^
Error: listen EADDRINUSE 
at exports._errnoException (util.js:746:11) 
at Server._listen2 (net.js:1156:14) 
at listen (net.js:1182:10) 
at Server.listen (net.js:1267:5) 
at ConnectApp.server (/home/azat/git/lasttest/node_modules/gulp-connect/index.js:57:19) 
at new ConnectApp (/home/azat/git/lasttest/node_modules/gulp-connect/index.js:37:10) 
at Object.module.exports.server (/home/azat/git/lasttest/node_modules/gulp-connect/index.js:170:12) 
at Gulp.<anonymous> (/home/azat/git/lasttest/gulpfile.js:112:11) 
at module.exports (/home/azat/git/lasttest/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7) 
at Gulp.Orchestrator._runTask (/home/azat/git/lasttest/node_modules/gulp/node_modules/orchestrator/index.js:273:3) 

回答

2

只需使用內置於手錶方法吞掉的依賴系統。

// default depends on 'server' so that the server is started before 
// the watches are started 
gulp.task('default', ['server'], function() { 
    // run jade whenever files in src/jade change 
    gulp.watch('src/jade/**', ['jade']); 

    // run images whenever files in src/images change 
    gulp.watch('src/images/**/*', ['images']); 
}); 

我不確定你在這裏需要一攬子批處理,除非你運行的是一次改變很多圖像的東西。

+0

沒有冒犯你,但這(官方)解決方案在概念上是錯誤的。 –