Open kobezzza opened 10 years ago
Scripts starting with shebang should be invoked directly from shell, not through node.js.
You are getting an error because /bin/bash
is not a valid interpreter for JavaScript.
Try something like #!/usr/bin/env node
and look for details about using shebang in general and especially for node.
Scripts starting with shebang should be invoked directly from shell, not through node.js.
Yes, but here is something else: the code is not transpiled - es6-transpiler error.
console.es6
#!/usr/bin/env node
/* my console app */
Why it should be transpiled? It is not a valid JS at all. Transpiler gives a proper error, cause you can not do tricks like this. Transpile your script first and then use transpiled output to make a shell script with a shebang.
This could be done optionally, for example
//#!/usr/bin/env node
/* my CLI app */
es6-transpiler myApp.es6 --sha-bang > myApp.js
->
#!/usr/bin/env node
/* my CLI app */
Why not? It is more convenient than writing wrapper.
Such things have no relation to JavaScript. You not blames browsers that throws an exception for invalid code and you can't blame transpiler for the same reasons. You should write the wrapper cause it is out of transpiler's responsibility zone.
Error: