1# global-dirs [![Build Status](https://travis-ci.org/sindresorhus/global-dirs.svg?branch=master)](https://travis-ci.org/sindresorhus/global-dirs) 2 3> Get the directory of globally installed packages and binaries 4 5Uses the same resolution logic as `npm` and `yarn`. 6 7 8## Install 9 10``` 11$ npm install global-dirs 12``` 13 14 15## Usage 16 17```js 18const globalDirs = require('global-dirs'); 19 20console.log(globalDirs.npm.prefix); 21//=> '/usr/local' 22 23console.log(globalDirs.npm.packages); 24//=> '/usr/local/lib/node_modules' 25 26console.log(globalDirs.npm.binaries); 27//=> '/usr/local/bin' 28 29console.log(globalDirs.yarn.packages); 30//=> '/Users/sindresorhus/.config/yarn/global/node_modules' 31``` 32 33 34## API 35 36### globalDirs 37 38#### npm 39#### yarn 40 41##### packages 42 43Directory with globally installed packages. 44 45Equivalent to `npm root --global`. 46 47##### binaries 48 49Directory with globally installed binaries. 50 51Equivalent to `npm bin --global`. 52 53##### prefix 54 55Directory with directories for packages and binaries. You probably want either of the above. 56 57Equivalent to `npm prefix --global`. 58 59 60## Related 61 62- [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module 63- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module 64- [is-installed-globally](https://github.com/sindresorhus/is-installed-globally) - Check if your package was installed globally 65 66 67## License 68 69MIT © [Sindre Sorhus](https://sindresorhus.com) 70