node.js - how to debug SyntaxError: unexpected INDENT error? -


i'm working through peepcode express tutorial, trying follow along , things running, i'm getting following error when run npm start, seems coffeescript lib problem, def don't want in weeds this, thoughts on go?

[jd@mbp ~/dropbox/node_projects/tutorials/hot_pie]$ npm start

application-name@0.0.1 start /users/jd/dropbox/node_projects/tutorials/hot_pie node server.js

/users/jd/dropbox/node_projects/tutorials/hot_pie/node_modules/coffee-script/lib/coffee-   script/helpers.js:199 throw error;       ^ syntaxerror: unexpected indent 

any thoughts? coffescript version "coffee-script": "~1.6.3" , node v0.10.13

for debugging syntax errors suggest compiling coffeescript "manually". i've found node's automatic compilation confuses things more helps.

so, in case:

$ coffee --compile server.coffee

now, create server.js file (which you'll want remove not confuse node). if coffeescript invalid coffee throw error.

edit:

to add answer, syntax check entire project via following: copy coffeescript files in project. coffescript source files live in app/, lib/, config/ , test/ directories in project. i've created temp directory, copy coffeescript files try compile them all.

$ rm -rf temp/*.coffee $ rm -rf temp/*.js $ cp app.coffee temp/ $ find test app lib config test  -name "*.coffee" -exec cp \{\} ./temp \; $ coffee --compile ./temp/ 

Comments