如何在Node / Express中debuggingEJS模板

我正在将PHP模板转换为Node.js / Express中的EJS。 模板文件有点复杂,所以debugging它们并不容易。 节点没有给我任何有用的信息进行debugging,所以这使得这个任务几乎不可能。 这是一个示例错误消息。

SyntaxError: Unexpected string in "app/views/profile/index.ejs" at Object.Function (<anonymous>) at exports.compile (/Users/Gavin/Web/node_modules/ejs/lib/ejs.js:237:14) at Object.exports.render (/Users/Gavin/Web/node_modules/ejs/lib/ejs.js:284:10) at View.exports.renderFile [as engine] (/Users/Gavin/Web/node_modules/ejs/lib/ejs.js:318:20) at View.render (/Users/Gavin/Web/node_modules/express/lib/view.js:76:8) at Function.app.render (/Users/Gavin/Web/node_modules/express/lib/application.js:502:10) at ServerResponse.res.render (/Users/Gavin/Web/node_modules/express/lib/response.js:777:7) at Object.exports.profile_index [as handle] (/Users/Gavin/Web/app/controllers/routes/profile.js:72:6) at next_layer (/Users/Gavin/Web/node_modules/express/lib/router/route.js:103:13) at Object.exports.verify_user [as handle] (/Users/Gavin/Web/app/controllers/routes/account.js:305:10) 

find这样一个模糊的错误信息的来源是非常乏味的。 有一个更简单的方法来debuggingEJS文件?

我同意错误信息是模糊的! 有一些开源应用程序在其应用程序中更好地进行error handling。 我使用Mean.Js

他们的消息更容易理解,它实际上指向一行代码,并给你一些提示来纠正它。 它易于使用。

我希望它有帮助!