Package Exports
- npm-root
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npm-root) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
npm-root
Get the node modules directory, a.k.a. npm root. Global or local.
Installation
Install npm-root
using npm:
npm install --save npm-root
Usage
Module usage
var npmRoot = require('npm-root');
// Get the local node_modules path:
npmRoot(function (err, localPath) {
// ...
});
// Get the local node_modules path for another directory:
npmRoot({cwd: '/path/to/other/folder'}, function (err, localPath) {
// ...
});
// Get the global node_modules path:
npmRoot({global: true}, function (err, globalPath) {
// ...
});
API
npmRoot(opts, cb)
Name | Type | Description |
---|---|---|
opts | Object |
Options (optional) |
cb | Function |
Callback function |
opts.global
Set this to get the global node_modules path instead of the local.
opts.cwd
Change current working directory, affects only the local node_modules path.
License
MIT