# read-package-up

> Read the closest package.json file

Latest version **12.0.0** (published 2025-11-07) · MIT license · 0 weekly downloads

> **Better alternative:** See documentation for alternatives (https://github.com/AikidoSec/module-replacements/blob/main/docs/read-package-up)

## Install

```sh
npm install read-package-up
pnpm add read-package-up
yarn add read-package-up
bun add read-package-up
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 12.0.0 |
| Published | 2025-11-07 |
| First published | 2023-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 3 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 267 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | json, read, parse, file, fs, graceful, load, package, find, up, find-up, findup, look-up, look, search, match, resolve, parent, parents, folder, directory, walk, walking, path |

## Links

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

## Dependencies (3)

- [read-pkg](https://npm.io/package/read-pkg.md) ^10.0.0
- [type-fest](https://npm.io/package/type-fest.md) ^5.2.0
- [find-up-simple](https://npm.io/package/find-up-simple.md) ^1.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 12.0.0 (latest) — 2025-11-07
- 11.0.0 — 2023-11-04

## README

# read-package-up

> Read the closest package.json file

## Why

- [Finds the closest package.json](https://github.com/sindresorhus/find-up)
- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json)
- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails)

## Install

```sh
npm install read-package-up
```

## Usage

```js
import {readPackageUp} from 'read-package-up';

console.log(await readPackageUp());
/*
{
	packageJson: {
		name: 'awesome-package',
		version: '1.0.0',
		…
	},
	path: '/Users/sindresorhus/dev/awesome-package/package.json'
}
*/
```

## API

### readPackageUp(options?)

Returns a `Promise<object>`, or `Promise<undefined>` if no `package.json` was found.

### readPackageUpSync(options?)

Returns the result object, or `undefined` if no `package.json` was found.

#### options

Type: `object`

##### cwd

Type: `URL | string`\
Default: `process.cwd()`

The directory to start looking for a package.json file.

##### normalize

Type: `boolean`\
Default: `true`

[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.

## Related

- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file
- [package-up](https://github.com/sindresorhus/package-up) - Find the closest package.json file
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
- [package-config](https://github.com/sindresorhus/package-config) - Get namespaced config from the closest package.json

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