如何在node.js中设置最大堆栈大小?

时间:2015-05-26 13:20:36

标签: javascript node.js pandoc

将docx转换为epub时出错。

我增加了堆栈大小,但任务是徒劳的。

错误:

 RangeError: Maximum call stack size exceeded
at Array.filter (native)
at writeAll (D:\xxx\WorkingFolder\xxxx\public\node_modules\mammoth\lib\html-generator.js:73:15)
at Object.text (D:\xxxx\WorkingFolder\ACS_Live\public\node_modules\mammoth\lib\html-generator.js:12:13)
at DocumentConversion.elementConverters.text (D:\xxxx\WorkingFolder\x_x\public\node_modules\mammoth\lib\document-to-html.js:229:18)
at elementToHtml (D:\xxxx\WorkingFolder\xx_xx\public\node_modules\mammoth\lib\document-to-html.js:71:13)
at eval (D:\xxxx\WorkingFolder\xxxx\public\node_modules\mammoth\lib\document-to-html.js:64:20)
at iterate (D:\xxx\WorkingFolder\xxx_Live\public\node_modules\mammoth\node_modules\async\lib\async.js:134:13)
at Object.async.eachSeries (D:\xxx\WorkingFolder\xxx_Live\public\node_modules\mammoth\node_modules\async\lib\async.js:150:9)
at convertElements (D:\xxx\WorkingFolder\xxx_Live\public\node_modules\mammoth\lib\document-to-html.js:63:15)
at convertRun (D:\xxxx\WorkingFolder\xxx_Live\public\node_modules\mammoth\lib\document-to-html.js:122:9)
at elementToHtml (D:\xxx\WorkingFolder\xxx_Live\public\node_modules\mammoth\lib\document-to-html.js:71:13)
at eval (D:\xxxx\WorkingFolder\xxx_Live\public\node_modules\mammoth\lib\document-to-html.js:64:20)

解决方案:实际上这不是node.js错误但是猛犸象(参见上面的错误日志)。在将doc转换为epub时,样式不会转换。那是没有适当的有效文件。我检查并删除那些页面。现在工作正常。

1 个答案:

答案 0 :(得分:0)

使用
node --stack-size=val 改变最大堆栈大小。