Node-red terminating indefinitely

Node-red is terminating after few minutes of running and the error in the command prompt is
"FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory", I am using windows 10 os and RAM is 8GB. Does anyone have a solution?

You should be able to start by moving your flows file to a new name and then starting Node-RED.
See the docs for how to do this

But what were you doing in Node-RED?

Essentially, your flows are using too much memory. The solution will depend on what your flows are doing. Are handling lots of messages, or large objects? If it happens after only a few minutes, your flow must be actively doing something, rather than waiting passively for an event to occur.

reading a sensor serially and store it in a file with time stamp

I have a serial port which publishes 100 readings per second. Even when serial ports are disconnected node-red is crashing. the function block consists of following code.

image

What hardware is this running on ? 200 messages a second (100 x two inputs) is quite fast.... The main issue may in fact be sending it to the debug nodes that have to send everything to the screen... it may work better without the debug nodes, though 200 msgs sec may still be too fast for the file writes when the files start to get large.

Even I deploy other basic examples node-red is crashing

with the same message?

Yes with the same message it is crashing

When you ...deploy other basic examples node-red is crashing - are you deploying these tests in the same Node-red that has the 100/sec reading? Or do you start with a blank flow when you statup NR?

I have used new flow for it

Post what you see in the terminal when you start node red from a terminal. The log starts with a Welcome to node-RED message. Include the command you used to start node red when you copy/paste. You can copy from a terminal using Ctrl-Shift-C.

I re-installed node.js and now its working fine

Thank you all for your wonderful support