node.js - How to compile string of coffeescript code in javascript? -



node.js - How to compile string of coffeescript code in javascript? -

so let's have string of coffeescript code, in javascript file on nodejs. how convert string javascript, without using terminal? have tried coffeescript-compiler, gave me error closed socket. have coffeescript installed globally , coffee-script compiler installed locally.

edit: here code:

var compiler = require('coffeescript-compiler'); var cc = new compiler(); cc.compile('a = 5', function (status, output) { if (status === 0) { // javascript available string in `output` variable } });

and here error throws:

events.js:72 throw er; //unhandled 'error' event error: socket closed. @ socket._write (net.js:637:19) @ dowrite (_stream_writable.js:225:10) @ writeorbuffer (_stream_writable.js:215:5) @ socket.writable.write (_stream_writable.js:182:11) @ socket.write (net.js:615:40) @ docompile (d:\tsa\app\node_modules\coffeescript-compiler\compiler.js:33:15) @ compiler.compile (d:\tsa\app\node_modules\coffeescript-compiler\compiler.js:46:3) @ object.<anonymous> (d:\tsa\app\coffeescript.js:4:4) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10)

you utilize online converter.

or, coffeescript(http://coffeescript.org/) homepage has tab: "try coffeescript", paste coffeescript code , see equivalent in javascript.

javascript node.js coffeescript

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -