Can the pm2 node module restarts the app after crash automatically
Yes, it does this by default. For more information see Restart strategies.
If the app repeatedly fails to start over a short period of time, pm2 may cease restarting. See configuration, min_uptime
and max_restarts
.
Also, check this new excellent option:
--exp-backoff-restart-delay=100
pm2
will restart the crashed app after 100 milliseconds (0.1 seconds), then step-by-step increase restart-delay to 15 seconds.