2014-06-20 4 views
5

Node.js/Express의 EJS로 PHP 템플릿을 변환하고 있습니다. 템플릿 파일은 다소 복잡하므로 디버깅이 쉽지 않습니다. 노드가 디버깅에 유용한 정보를 제공하지 않기 때문에이 작업을 거의 불가능하게 만듭니다. 다음은 샘플 오류 메시지입니다.Node/Express에서 EJS 템플릿을 디버깅하는 방법

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) 

그런 막연한 오류 메시지의 출처를 찾는 일은 지루합니다. EJS 파일을 디버그하는 쉬운 방법이 있습니까?

답변

0

나는 오류 메시지가 모호하다는 데 동의합니다! 응용 프로그램에서 더 나은 오류 처리를하는 일부 오픈 소스 응용 프로그램이 있습니다. 나는 사용한다 Mean.Js

그들의 메시지는 이해하기 쉽다. 그리고 그것은 실제로 코드 줄을 지적하고 그것을 암시하는 몇 가지 힌트를 준다. 함께 사용하기 쉽습니다.

도움이 되었기를 바랍니다.

관련 문제