DeprecationWarning:不建议在不回调的情况下调用异步函数。 - 如何找到“功能:”的位置是什么? [英] DeprecationWarning: Calling an asynchronous function without callback is deprecated. - how to find where the "function:" is?
问题描述
我最近将我的节点更新为7.2.1并发现有警告:
I recently updated my node to 7.2.1 and noticed that there is a warning coming:
(节点:4346)弃用警告:不推荐在没有回调的情况下调用异步函数。
(node:4346) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
这是什么 4346
for ?我在js文件中只有2000行,所以它不能是行号。我在哪里可以找到代码?
What is this 4346
for? I only have 2000 lines in the js file, so it can't be a line-number. Where can I find the code?
推荐答案
您可以使用 - trace-deprecation
或 - throw-deprecation
options。
You can use either the --trace-deprecation
or --throw-deprecation
options.
例如:
node --trace-deprecation app.js
或:
node --throw-deprecation app.js
第一个选项将记录堆栈跟踪,第二个选项将引发错误(如果未捕获,则还会记录堆栈跟踪)。
The first option will log a stack trace and the second will throw an error (which, if not caught, will also log a stack trace).
此外, 4346
很可能是进程ID。
Also, 4346
is most likely the process ID.
这篇关于DeprecationWarning:不建议在不回调的情况下调用异步函数。 - 如何找到“功能:”的位置是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!