# global-dirs

> Get the directory of globally installed packages and binaries

Latest version **4.0.0** (published 2023-11-06) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install global-dirs
pnpm add global-dirs
yarn add global-dirs
bun add global-dirs
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2023-11-06 |
| First published | 2017-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 78 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | global, prefix, path, paths, npm, yarn, node, modules, node-modules, package, packages, binary, binaries, bin, directory, directories, npmrc, rc, config, root, resolve |

## Links

- npm: https://www.npmjs.com/package/global-dirs
- Repository: https://github.com/sindresorhus/global-dirs
- Homepage: https://github.com/sindresorhus/global-dirs#readme
- Issues: https://github.com/sindresorhus/global-dirs/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/global-dirs

## Dependencies (1)

- [ini](https://npm.io/package/ini.md) 2.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2023-11-06
- 3.0.1 — 2022-11-16
- 3.0.0 — 2021-01-12
- 2.1.0 — 2020-12-14
- 2.0.1 — 2019-11-08
- 2.0.0 — 2019-09-17
- 1.0.0 — 2019-05-02
- 0.1.1 — 2017-11-19
- 0.1.0 — 2017-06-25

## README

# global-dirs

> Get the directory of globally installed packages and binaries

Uses the same resolution logic as `npm` and `yarn`.

## Install

```
$ npm install global-dirs
```

## Usage

```js
const globalDirectories = require('global-dirs');

console.log(globalDirectories.npm.prefix);
//=> '/usr/local'

console.log(globalDirectories.npm.packages);
//=> '/usr/local/lib/node_modules'

console.log(globalDirectories.npm.binaries);
//=> '/usr/local/bin'

console.log(globalDirectories.yarn.packages);
//=> '/Users/sindresorhus/.config/yarn/global/node_modules'
```

## API

### globalDirectories

#### npm
#### yarn

##### packages

Directory with globally installed packages.

Equivalent to `npm root --global`.

##### binaries

Directory with globally installed binaries.

Equivalent to `npm bin --global`.

##### prefix

Directory with directories for packages and binaries. You probably want either of the above.

Equivalent to `npm prefix --global`.

## Related

- [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module
- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module
- [is-installed-globally](https://github.com/sindresorhus/is-installed-globally) - Check if your package was installed globally

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-global-dirs?utm_source=npm-global-dirs&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

---
_Source: https://npm.io/package/global-dirs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
