Unknown internal error in nodejs runMicrotasks()

Viewed 2419

When i try to run a nodejs program, i get the following error:

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 works just fine. When i try to run a js file i get the error.

2 Answers

Because This error is caused when you call a function that expects an Object as its argument, but pass undefined or null instead U can try

If(obj == null)
{
console.log(null)//or return null
}

Fixed by updating windows 10 and installing a newer version of node.

Related