Locates executables from locally or parent-installed node modules, similar to `which` but respecting npm's PATH. Version 3.0.1 is stable with no recent releases. Key differentiator: it is faster than shelling out to `npm bin` and works across the node_modules hierarchy, not just the current directory. Supports both async and sync APIs, and a CLI. Requires Node >=4.2.0, no runtime dependencies.
npm install npm-whichVerified import paths — ran on the pinned version, not inferred.
Shows programmatic usage (async and sync) and CLI invocation.
Use require('npm-which')(cwd) instead of require('npm-which').Call npmWhich(cwd) instead of npmWhich()(name, {cwd}).Always provide cwd: const which = require('npm-which')(process.cwd());Use which(1) for global executables.
For multiple results, consider a different tool or iterate over PATH manually.
const which = require('npm-which')(cwd); then which(name);Pass a cwd string: require('npm-which')(__dirname);Install the package locally: npm install tape; or ensure it is in a parent node_modules.
npm install -g npm-which
No dependency data recorded yet.