Gulp调试-管道到进程.stdout给出TypeError('无效数据')

Gulp debugging - piping to process.stdout gives TypeError('invalid data')

本文关键字:无效 数据 TypeError 给出 调试 管道 stdout 进程 Gulp      更新时间:2023-09-26

我正在尝试调试我编写的Gulp任务。我试着使用'gulp-debug'模块,但它真正做的只是统计一个文件。。。这对我没有用。

对于初学者来说,我如何使流程进入终端?我想看看wiredep在输出什么。我试过.pipe(process.stdout),但我得到了TypeError('invalid data')

var bowerStream = gulp.src('./app/bower_components')
    .pipe(wiredep())
    .pipe(process.stdout)

使用through2这是可能的:

gulp.src('./app/index.html')
  .pipe(wiredep({directory: './app/bower_components'}))
  .pipe(through2.obj(function(obj, enc, next) {
    this.push(obj.contents);
    next();
  })).pipe(process.stdout);

我知道这有点晚了,不过,我刚刚写了一篇关于如何在visual studio代码中调试gull任务的博客文章:https://hansrwindhoff.wordpress.com/2015/05/05/debugging-task-runner-tasks-like-gulp-with-visual-studio-code-editordebugger/

您可以启动VSCode调试器来运行gull任务,然后对所有插件和gull文件进行完整的源代码级别调试。非常方便!