Create wrapper executable Global module node

I tried to create a node module, I succeeded, I used npm install -g

in the code directory and created this module folder in \AppData\Roaming\npm\node_modules\myfirstmodule

. Now I want to make one executable as a command like pm2. How can i do this? so I can type myfirstmodule

in the command line anywhere and it will execute index.js from that module.

+3


source to share


1 answer


Your .json package can provide a map called bin that will make the commands available. See this tutorial for details .



+6


source







All Articles