如何调试gulpfile.js文件

2025-04-29 01:42:41
推荐回答(1个)
回答1:

1.安装 node-inspector
npm install -g node-inspector
2.使用node debug
node-debug $(which gulp) myTask
3.根据提示信息 访问 chrome 就行
另外你如果需要暂停你的gulp程序,需要在 gulpfile.js中加入 debugger;
gulp.task('myTask', function() {
debugger;
gulp
.src('myPath/files/**/*')
.pipe(someAction())
.pipe(gulp.dest('newPath/files'));
});