4

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.

2
  • I don't have an answer but I would look at NPM and the values inside of package.json - as those are the things that called. Commented Jun 22, 2015 at 13:17
  • @akaphenom, I tried for that, but I am not getting any key will create a batch file to execute that module. Commented Jun 22, 2015 at 13:19

1 Answer 1

7

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

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

Comments

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.