Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Just noticed the docs have a tutorial on creating a command line interface app[0]. Thanks for this. Would love to read the next steps involved in making the app accessible with with just `fibonacci`, as opposed to `npm start fibonacci`.

[0]https://noderize.js.org/docs/tutorials-cli.html



Check out something like pkg by zeit[0] which compiles the node app to a binary. Then put it in a directory in your $PATH and you'll be able to run it as `fibonacci`.

[0]https://github.com/zeit/pkg


The easiest way is simply to use npm's bin, which if installed globally (npm i -g my-command) is added to path.


I’m interested in making binaries, to hopefully ease distributing in-house utils. Our various projects depend on misc node versions and reinstalling our utils to each new global bin ain’t fun. If there’s a better way, I’m all ears.


Please don't use this if the project is for work/something you care about, because it's a bitch to support in production, especially when compatibility becomes an issue. Better to not mention it at all in a work related context and just say there's no way to distribute nodeJS applications as binaries.


Good idea! I'll add it to the tutorial on the next release.

It's basically making a custom entry for that specific command and adding it as a bin in the package.json.


`sudo npm link` will do that




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: