运行 gulp 任务时如何解决“不推荐使用 MakeCallback 中的域属性”警告?

jos*_*t21 3 node.js gulp

我正在使用带有 gulp 的节点来运行一些构建任务。直到几天前,这一切正常。现在(我假设在升级/更新之后,不确定是哪个特定的。我相信这是节点从 14.4 到 14.5 的更新)我不断收到此警告

[DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Run Code Online (Sandbox Code Playgroud)

我不知道如何--trace-deprecation与 gulp一起使用,所以我找不到触发它的原因。
我的实际gulpfile更长,注释掉部分,更改pipeline.pipe,更新节点和依赖项,使用async/await,以及其他一些小的更改并没有让我更接近缩小问题的范围。

因此,我在下面设置了这个最小的工作示例:

  • 运行默认的 gulp 任务 ( clean_fake) 不会触发警告
  • 双方gulp cleangulp styles导致警告显示
[DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Run Code Online (Sandbox Code Playgroud)

当前版本:
节点:v14.5.0
npm:6.14.6

删除:5.1.0
吞咽:4.0.2
吞咽:4.1.0

PS:有这个类似的问题,但我的问题没有答案。

更新:

我想出了如何通过运行它来跟踪弃用NODE_OPTIONS

NODE_OPTIONS='--trace-deprecation' gulp
Run Code Online (Sandbox Code Playgroud)

但是输出对我没有多大帮助

(node:146806) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
    at emitMakeCallbackDeprecation (domain.js:123:13)
    at FSReqCallback.topLevelDomainCallback (domain.js:134:5)
    at FSReqCallback.callbackTrampoline (internal/async_hooks.js:121:14)
Run Code Online (Sandbox Code Playgroud)

Ale*_*ara 8

这是Node 14.5.0 中的一个已知问题,由async-done使用已弃用domain模块的 Gulp 依赖引起,显示此警告。

根据链接的 Gulp 问题中的帖子,在 Gulp 使用相关代码的上下文中,弃用错误不是故意的。

在 Node 14.6.0 中,所有 Gulp 任务任务不再显示此警告(您的自定义代码可能会触发警告,但如果您的代码以某种方式以已弃用的方式使用该模块)。