Get the path of the given package(s) if it is installed globally or locally.
Primarily, this module is designed to search modules for VS Code (Language Server Extensions, etc).
const nmp = require('npm-module-path');
nmp.resolveOne('mocha').then((filepath) => {
console.log(filepath); // ['/home/travis/.nvm/versions/node/v6.6.0/lib/node_modules/mocha']
});
nmp.resolveMany(['mocha', 'tslint']).then((filepaths) => {
console.log(filepaths); // ['node_modules/mocha', '/usr/lib/node_modules/tslint']
});
The root directory of the project to search the module.
Return the path to the directory where the module was found.
This software is released under the terms of the MIT license.