Finding: Syntax error unexpected end of file

38 views
Skip to first unread message

Theodor Esenwein

unread,
Jan 25, 2016, 2:48:08 AM1/25/16
to nodejs
Hi there....

Can anyone help me to find a error. One of my NodeJS 5.5 / expressJS application quits with the error: "syntax error unexpected end of file"
Unfortunately it gives no line at all. Any idea how to hunt and find the location of this error?

The hole project is in Typescript and compiles just fine...

Any ideas?


Ebrahim Pasbani

unread,
Jan 26, 2016, 11:37:25 PM1/26/16
to nodejs
Use jshint to find syntax error

George Snelling

unread,
Jan 30, 2016, 2:14:07 AM1/30/16
to nodejs
If the error message includes the name of the file with the problem, try

node <file.js>

If you have compile errors in code that is only compiled at runtime this trick will sometimes spot the problem and give you a line number.  We've hit this in our nodeunit tests.  Those wiser in the ways of V8 parsing and execution perhaps can explain why.  

-g

Zlatko

unread,
Jan 31, 2016, 10:39:21 AM1/31/16
to nodejs
In addition to other suggestions of finding this particular bug, you might also look into including sourcemaps when transpiling your ts code, for dev environment at least. It might help out with these kinds of issues.
Reply all
Reply to author
Forward
0 new messages