package
Local and global search module directory
npm install npm-module-pathGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Get the path of the given package(s) if it is installed globally or locally.
$ npm i -S npm-module-pathPrimarily, this module is designed to search modules for VS Code (Language Server Extensions, etc).
require).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']
});cache
String.The root directory of the project to search the module.
resolveDir
BooleanfalseReturn the path to the directory where the module was found.
resolveOnlyByPrefix
BooleanfalseSkip search modules in the default directories and search them only by npm config get prefix.
See the Releases section of our GitHub project for changelogs for each release version.
This software is released under the terms of the MIT license.