我正在用 node.js 编写一个应用程序,最近我的所有项目都出现了意外错误。
当我尝试在浏览器中调用模型时,我总是得到一个
SyntaxError: Unexpected identifier
在我的代码中调用的任何函数上。
例如,如果我继续“/session/new”,
我的代码是:
app.get('/session/new',function (req,res) {
res.render('sessions/new',{locals:{
redir:req.query.redir
}});
});
我得到一个错误
SyntaxError: Unexpected identifier
at Object.Function (unknown source)
at Object.render (/usr/local/lib/node/.npm/jade/0.6.3/package/lib/jade.js:267:14)
at ServerResponse.render (/usr/local/lib/node/.npm/express/1.0.7/package/lib/express/view.js:334:22)
at ServerResponse.render (/usr/local/lib/node/.npm/express/1.0.7/package/lib/express/view.js:344:10)
at Object.<anonymous> (/Users/geraudmathe/Desktop/nodemongo/app.js:133:6)
at param (/usr/local/lib/node/.npm/connect/0.5.2/package/lib/connect/middleware/router.js:145:21)
at pass (/usr/local/lib/node/.npm/connect/0.5.2/package/lib/connect/middleware/router.js:161:10)
at Object.router [as handle] (/usr/local/lib/node/.npm/connect/0.5.2/package/lib/connect/middleware/router.js:167:6)
at next (/usr/local/lib/node/.npm/connect/0.5.2/package/lib/connect/index.js:232:23)
at next (/usr/local/lib/node/.npm/connect/0.5.2/package/lib/connect/index.js:234:17)
/nodemongo/app.js:133:6 在我的代码中是 res.render 。
无论我调用什么代码,它都会发生。
我迷路了 ...