lundi 6 avril 2015

How to run Node.js program from command line without word 'node'

I am developing the Node.js package, which includes a command-line utility. Now alacon.js is located in the root of the package. To run this utility I have to use word node before the name of utility, like:



node alacon 'SELECT * FROM CSV("mydata.csv") ORDER BY 2'


Could you help me, what should I change in the package to:


1.To run this utility without node word, like:



alacon 'SELECT * FROM CSV("mydata.csv") ORDER BY 2'


2.To install this package globally and use the utility everywhere on computer:



npm install -g alasql
alacon 'SELECT 2*2'


In other words, how to create utility like Jison, Gulp and other Node.js similar packages with command-line programs.


I already add the #!/usr/bin/env node line to the top of the file, but unfortunately have no desired effect.


Thank you!


Aucun commentaire:

Enregistrer un commentaire