npm

Need private packages and team management tools?Check out npm Orgs. »

resolve-npm-which

1.0.1 • Public • Published

resolve-npm-which

stable

For a CLI module like "browserify" or "watchify", resolves to the path for that module in local or global installs.

var find = require('resolve-npm-which')
 
find('browserify', {
  basedir: process.cwd()
}, function(err, file) {
  if (err) throw err
  
  // now require it !
  var browserify = require(file)
})

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

NPM

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.

install

npm i resolve-npm-which

Downloadsweekly downloads

3

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability