Some packages install command-line programs. A side effect of installing such packages is a new command that you can type at the shell prompt or use in shell scripts. An example is the hexy program that we briefly used in Chapter 2, Setting up Node.js. Another example is the widely used Grunt or Gulp build tools.
The package.json file in such packages specifies the command-line tools that are installed. The command can be installed to one of two places:
- Global Install: It is installed either to a directory such as /usr/local, or to the bin directory where Node.js was installed. The npm bin -g command tells you the absolute pathname for this directory.
- Local Install: To node_modules/.bin in the package where the module is being installed. The npm bin command tells you the absolute pathname for this directory.
To run the command, simply type the command name at a shell prompt. Except there's a little bit of configuration required to make that simple.