1 # global-dirs [![Build Status](https://travis-ci.org/sindresorhus/global-dirs.svg?branch=master)](https://travis-ci.org/sindresorhus/global-dirs)
3 > Get the directory of globally installed packages and binaries
5 Uses the same resolution logic as `npm` and `yarn`.
11 $ npm install global-dirs
18 const globalDirs = require('global-dirs');
20 console.log(globalDirs.npm.prefix);
23 console.log(globalDirs.npm.packages);
24 //=> '/usr/local/lib/node_modules'
26 console.log(globalDirs.npm.binaries);
29 console.log(globalDirs.yarn.packages);
30 //=> '/Users/sindresorhus/.config/yarn/global/node_modules'
43 Directory with globally installed packages.
45 Equivalent to `npm root --global`.
49 Directory with globally installed binaries.
51 Equivalent to `npm bin --global`.
55 Directory with directories for packages and binaries. You probably want either of the above.
57 Equivalent to `npm prefix --global`.
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
69 MIT © [Sindre Sorhus](https://sindresorhus.com)