I had faced this issue sometimes back. I followed below method to fix this issue.
Below one command helped me to resolve the issue:
This error is probably because of your memory leak or difference between the Node <= 10 and Node > 10 manage the memory. So increasing your memory allocated to your Node will allow the program to run properly but it may not completely solve the real problem and it may happen that your memory limit could be reached again. That’s why I am advising for profiling memory usage in your node process whenever it starts running.
I had the problem with the memory leak.
And it clearly suggested to increase my memory, in my terminal where I was running my Node process:
The values of the
max-old-space-size can be in the range of:
[2048, 4096, 8192, 16384]
Hope you understood the solution for your issue.