我的脚本失败:致命错误:JS分配失败当试图加载模板,并出现以下错误
FATAL ERROR: JS Allocation failed - process out of memory exited with code 5
那我打电话看起来像这样的代码:
emailTemplates(templatesDir, function(err, template) {
winston.info("Setting up templates.", templatesDir);
if(err) {
winston.error(err);
}else{
var today = new Date().getDay();
winston.info("Found that today is ", aDays[today]);
template("notify", {
reports: [{
item: "merged",
desc: "Blah blah"
},{
item: "searched",
desc: "Blah blah"
}],
vars: Operators.BBT.mail,
day: aDays[today],
fusionAPIRan: canRunFAPI
}, function(err, html, text) {
if(err) {
winston.error(err);
}else{
winston.info("Attempting to send an email!");
smtpTransport.sendMail({
from: "Webmaster <[email protected]>",
to: "[email protected]",
subject: "Worker - Notification Email",
html: html
}, function(error, response){
if(error){
winston.error(error);
cb(false);
}else{
winston.info("Message sent: " + response.message + ", message id: " + response.messageId);
cb(true);
}
});
}
});
}
});
它得到尽可能多的Found that today is xxx
和winston.error
里面不会被调用。这是什么原因造成的?也许是一个狡猾的模板?