0

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!

1 Answer 1

1

You will need to make the script executable chmod a+x alacon.

Then you should be able to run ./alacon 'SELECT * FROM CSV("mydata.csv") ORDER BY 2'

If you wish to invoke the script without ./ then you will need to move it (or symlink it) to /usr/bin.

Alternatively - you could create an alias: alias alacon="node alacon"

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! Do you know, how to change package for global installation?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.