I'm writing an app in node.js and recently i had an unexpected error on all my project.
When i try to call a model in my browser , i always get a
SyntaxError: Unexpected identifier
On any function called in my code .
For example, if i go on "/session/new",
my code is :
app.get('/session/new',function (req,res) {
res.render('sessions/new',{locals:{
redir:req.query.redir
}});
});
and i get an error
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)
where /nodemongo/app.js:133:6 is res.render in my code.
It happen no matter what code i call.
I'm lost ...
I have found this issue to be a different sum of things, it could be that you have an unsupported attr on a jade template call, eg:
<img src="something.jpg" rel="prettyPhoto" />
It took me forever to find this out, and the only way to do this would be to start taking lumps of code out of the jade template file you are calling in your res.render.
Good luck, this error can be a lot of things.
Update: http://groups.google.com/group/express-js/browse_thread/thread/b9acfc80f6acb63b?pli=1
You can use jade index.jade
to debug the file
In my case it was an issue with the syntax
I had:
input.search-query(placeholder="Search" type="text")
It should have been
input.search-query(placeholder="Search", type="text")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With