Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create shell executable Global node module

Tags:

node.js

npm

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.

like image 613
Laxmikant Dange Avatar asked Mar 15 '23 16:03

Laxmikant Dange


1 Answers

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

like image 145
des09 Avatar answered Mar 30 '23 16:03

des09