Gulp 4.0.2无法编译
我刚刚升级到Angular 4.4.7和Typescript 2.7.2。我正在尝试运行Gulp 4.0.2并编译我的TS文件,但我遇到了此错误。
[12:50:49]您是否忘记了发出异步完成的信号? 节点:事件:498 投掷er; //未经处理的“错误”事件 ^
**
* Compile TypeScript sources
*/
gulp.task("compile", gulp.series("clean", function () {
return gulp.src("./App/**/*.ts")
.pipe(inlineNg2Template({
base: "/", // Angular2 application base folder
target: "es6", // Can swap to es5
indent: 2, // Indentation (spaces)
useRelativePaths: false, // Use components relative assset paths
removeLineBreaks: false, // Content will be included as one line
templateExtension: ".html", // Update according to your file extension
templateFunction: false // If using a function instead of a string for `templateUrl`, pass a reference to that function here
}))
.pipe(typescript(tsProject))
.pipe(ignore("References.js"))
.pipe(gulp.dest("dist/App"))
.on('error', function (err) { console.log(err.message); });
}));
I just upgraded to Angular 4.4.7 and typescript 2.7.2. I am trying to run gulp 4.0.2 and compile my ts files but I am getting this error.
[12:50:49] Did you forget to signal async completion?
node:events:498
throw er; // Unhandled 'error' event
^
**
* Compile TypeScript sources
*/
gulp.task("compile", gulp.series("clean", function () {
return gulp.src("./App/**/*.ts")
.pipe(inlineNg2Template({
base: "/", // Angular2 application base folder
target: "es6", // Can swap to es5
indent: 2, // Indentation (spaces)
useRelativePaths: false, // Use components relative assset paths
removeLineBreaks: false, // Content will be included as one line
templateExtension: ".html", // Update according to your file extension
templateFunction: false // If using a function instead of a string for `templateUrl`, pass a reference to that function here
}))
.pipe(typescript(tsProject))
.pipe(ignore("References.js"))
.pipe(gulp.dest("dist/App"))
.on('error', function (err) { console.log(err.message); });
}));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上的
调用是有问题的,因为
返回一个新流,该流在基础流结束时不会结束。如果删除上面的行,情况将再次起作用。
如果您确实需要处理
错误
事件,则可以执行此操作,但是您仍然应该从任务功能返回管道流。请注意,尽管GULP已经从
错误
事件中打印出消息,但我不会手动重复该过程。The call to
on
is problematic, becauseon
returns a new stream that does not end when the underlying stream ends.If you remove the line above, things will work again.
If you really need to handle the
error
event, you can do it, but you should still return the piped stream from the task function.Note though that gulp already prints messages from
error
events, I would not repeat that process manually.