当我尝试运行 nodejs 程序时,出现以下错误:
node:internal/process/task_queues:96
runMicrotasks();
^
TypeError: Cannot convert undefined or null to object
at push (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
REPL Node 工作得很好。当我尝试运行 js 文件时,出现错误。
最佳答案
因为当您调用一个期望 Object 作为其参数的函数,但传递 undefined 或 null 时会导致此错误
你可以试试
If(obj == null)
{
console.log(null)//or return null
}
关于javascript - nodejs runMicrotasks() 中的未知内部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67870700/