witch
require.resolve for binaries
Given the name of a locally installed dependency, witch will return the paths to the module's associated binary scripts.
Example
const witch = require('witch');
witch('gulp');
For modules which include more than one binary script, you can pass a specific binary name as a second parameter.
const witch = require('witch');
witch('mocha', '_mocha');
FAQs
Aren't all my installed binaries symlinked into ./node_modules/.bin anyway?
No. This only applies to the top-level module. If you're writing code that might ever be installed as a child dependency then you should not assume the install paths of dependencies.