首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gulp.run()已被弃用。改为使用任务依赖关系或gulp.watch任务触发

gulp.run()已被弃用。改为使用任务依赖关系或gulp.watch任务触发
EN

Stack Overflow用户
提问于 2015-09-08 23:23:15
回答 1查看 1.6K关注 0票数 0

我的gulpfile有一个错误。有人能帮我吗?

它以前是有效的。但是在我添加了gulp watch插件之后,它就崩溃了。

那么我需要使用什么呢?

这是我的Gulpfile.js

这是一个日志:

代码语言:javascript
复制
azat@pc:~/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)
EN

回答 1

Stack Overflow用户

发布于 2015-09-09 03:45:21

只需在watch方法中使用gulp的依赖系统即可。

代码语言:javascript
复制
// 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']);
});

我不确定您是否需要在这里使用gulp batch,除非您正在运行一次更改多个图像的操作。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32461603

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档