global-node-modules

2.1.0 • Public • Published

global-node-modules NPM version NPM downloads Build Status

Find the global node_modules path.

Install

$ npm install --save global-node-modules

Usage

const globalNodeModules = require('global-node-modules')
 
globalNodeModules()
  .then(nodeModulesPath => {
    console.log(nodeModulesPath)
    //=> /Users/egoist/.nvm/versions/node/v4.2.4/lib/node_modules
  })
  .catch(e => {
    console.log(e.stack)
  })
 
// sync method
const nodeModulesPath = globalNodeModules.sync()

API

globalNodeModules(moduleName)

moduleName

Type: string
Default: ''

Give a moduleName to append to the path.

globalNodeModules.sync(moduleName)

License

MIT © EGOIST

Package Sidebar

Install

npm i global-node-modules

Weekly Downloads

0

Version

2.1.0

License

MIT

Last publish

Collaborators

  • kchan
  • rem