debuggingswig模板引擎,nodejs

是否有任何方法来debuggingswig模板引擎的node.js,因为我没有得到在某些情况下发生错误的确切文件,例如

{% set temp = JSON.parse('some random string') %} 

这是我在上面的控制台中得到的:

 2015-08-13T09:38:12.254Z - error: SyntaxError: Unexpected token s at Object.parse (native) at Object.eval [as tpl] (eval at <anonymous> (/home/saurabh/intl/via_node/node_modules/swig/lib/swig.js:498:13), <anonymous>:6:810) at compiled (/home/saurabh/intl/via_node/node_modules/swig/lib/swig.js:619:18) at Object.eval [as tpl] (eval at <anonymous> (/home/saurabh/intl/via_node/node_modules/swig/lib/swig.js:498:13), <anonymous>:27:611) at compiled (/home/saurabh/intl/via_node/node_modules/swig/lib/swig.js:619:18) at /home/saurabh/intl/via_node/node_modules/swig/lib/swig.js:559:20 at /home/saurabh/intl/via_node/node_modules/swig/lib/swig.js:690:9 at fs.js:268:14 at Object.oncomplete (fs.js:107:15) 

没有提及发生错误的模板文件。

编辑:你是对的,问题是'一些随机string',你不能JSON.parse一个string不是一个JSON。

所以你应该有这样的东西:

 {% set temp = JSON.parse('{"test": true}') %}