resolve-npm-which
For a CLI module like "browserify"
or "watchify"
, resolves to the path for that module in local or global installs.
var find =
First it will use the resolve algorithm to look through locals, and then it will fall back to npm-which to look through globals.
The callback provides the path to the module so that it can be required.
Usage
find(name, opt, cb)
Finds the module name
with the given options (passed to resolve), then calls cb
with the error/success state.
Options must include basedir
to search for.
Test
Note: To test, you need to have browserify
installed gobally, and npm config get prefix
should return a meaningful value.
License
MIT, see LICENSE.md for details.