Node.js “FATAL ERROR: JS Allocation failed – process out of memory” — possible to get a stack trace?

Just because this is the top answer on Google at the moment, I figured I’d add a solution for a case I just ran across:

I had this issue using express with ejs templates – the issue was that I failed to close an ejs block, and the file was js code – something like this:

var url="<%=getUrl("/some/url")"
/* lots more javascript that ejs tries to parse in memory apparently */

This is obviously a super specific case, OP’s solution should be used the majority of the time. However, OP’s solution would not work for this (ejs stack trace won’t be surfaced by ofe).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)