When my script fails to parse for any reason, I get a stack trace from the compiler, with no insight at all into where in my script the problem lies:
mpurvis@citadel:~/coffee$ coffee -c Test.coffee
/usr/local/lib/node_modules/coffee-script/lib/command.js:15
return process.binding('stdio').writeError(line + '\n');
^
Error: No such module
at /usr/local/lib/node_modules/coffee-script/lib/command.js:15:20
at /usr/local/lib/node_modules/coffee-script/lib/command.js:167:7
at /usr/local/lib/node_modules/coffee-script/lib/command.js:115:26
at [object Object].<anonymous> (fs.js:108:5)
at [object Object].emit (events.js:64:17)
at afterRead (fs.js:1074:12)
at Object.wrapper [as oncomplete] (fs.js:246:17)
For now, it’s just a toy script to try the system out, so I can usually just experiment until it works again, but that would be impossible in a file of any size. Is there some trick I’m not seeing to get the line where the error occurred?
Thanks!
This doesn’t look like a syntax issue. The error is coming from
command.js, which is what defines thecoffeecommand-line utility. If it were a compiler error, it would be fromcoffee-script.js.So why is the
process.binding('stdio')bit incommand.jsfailing? There are two possibilities I can think of:node -v? Your safest bet is the latest 0.4.x, since those are stable releases (0.5.x is experimental).