I believe you can install npm modules globally with the switcher -g. For instance, if we install express with the -g switcher we can use the command express to generate a new app.
So how does it run without having to do something like node express ... ?
That's because of a property in the package.json file called bin.
When you use it in combination with the -g switch, npm automatically wraps the files and make them available in your system, because when you installed node, npm modules where already added to your PATH.
Here's an example of package.json using the bin property:
{
"name": "mypackage",
"version": "1.0.0",
"bin": {
"mybin": "./lib/mybin.js",
"myotherbin": "./lib/myotherbin.js"
}
}
After installing this package globally, mybin and myotherbin will be available in your system.