I tried to create node module, I succeeded,
I used npm install -g
at code directory, and it created this module folder in \AppData\Roaming\npm\node_modules\myfirstmodule
, Now I want to make one file executable as command, like pm2. How can I do this? so I can type myfirstmodule
in command prompt at any location and it will execute index.js from that module.
Your package.json can provide a map called bin which will make commands available. See this tutorial for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With