# nypm

> Unified Package Manager for Node.js

Latest version **0.6.10** (published 2026-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install nypm
pnpm add nypm
yarn add nypm
bun add nypm
```

Provides the command `nypm`.

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.6.10 |
| Published | 2026-09-08 |
| First published | 2021-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 3 |
| Unpacked size | 50.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | pi0 |

## Links

- npm: https://www.npmjs.com/package/nypm
- Repository: unjs/nypm
- npm.io page: https://npm.io/package/nypm

## Dependencies (3)

- [citty](https://npm.io/package/citty.md) ^0.2.2
- [pathe](https://npm.io/package/pathe.md) ^2.0.3
- [tinyexec](https://npm.io/package/tinyexec.md) ^1.3.1

## Recent versions

- 0.6.10 (latest) — 2026-09-08
- 0.1.1 (latest-0.1) — 2023-04-12
- 0.6.9 — 2026-07-28
- 0.6.8 — 2026-06-28
- 0.6.7 — 2026-06-11
- 0.6.6 — 2026-04-24
- 0.6.5 — 2026-02-05
- 0.6.4 — 2026-01-20
- 0.6.3 — 2026-01-20
- 0.6.2 — 2025-09-15
- 0.6.1 — 2025-07-29
- 0.6.0 — 2025-02-25
- 0.5.4 — 2025-02-20
- 0.5.3 — 2025-02-20
- 0.5.2 — 2025-01-28
- … 22 more at https://npm.io/package/nypm/versions

## README

# 🌈 nypm

<!-- automd:badges color="yellow" codecov -->

[![npm version](https://img.shields.io/npm/v/nypm?color=yellow)](https://npmjs.com/package/nypm)
[![npm downloads](https://img.shields.io/npm/dm/nypm?color=yellow)](https://npm.chart.dev/nypm)
[![codecov](https://img.shields.io/codecov/c/gh/unjs/nypm?color=yellow)](https://codecov.io/gh/unjs/nypm)

<!-- /automd -->

🌈 Unified Package Manager for Node.js (npm, pnpm, yarn), Bun and Deno.

✅ Supports [npm](https://docs.npmjs.com/cli/v10/commands/npm), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/package-manager), [deno](https://deno.com/), [aube](https://github.com/jdx/aube) and [nub](https://github.com/nubjs/nub) out of the box with a unified API.

✅ Provides an **API interface** to interact with package managers.

✅ **Autodetects** project's package manager using `package.json` and known lockfiles.

✅ **[corepack](https://github.com/nodejs/corepack)** integration for **pnpm** and **yarn**.

## `nypm` command

**Install dependencies:**

```sh
npx nypm i
```

**Add a dependency:**

```sh
npx nypm add defu
```

**Remove a dependency:**

```sh
npx nypm remove defu
```

## API Usage

Install package:

```sh
# ✨ Auto-detect
npx nypm install nypm
```

Import:

```js
// ESM import
import { addDependency } from "nypm";

// or dynamic import
const { addDependency } = await import("nypm");
```

### `addDependency(name, options)`

Adds dependency to the project.

### `addDevDependency(name, options)`

Adds dev dependency to the project.

### `detectPackageManager(cwd, options)`

Detect the package manager used in a directory (and up) by checking various sources:

1. Use `packageManager` field from package.json
2. Use [`devEngines.packageManager`](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#devengines) field from package.json
3. Known lock files and other files

### `ensureDependencyInstalled(name, options)`

Ensures dependency is installed.

### `installDependencies(options)`

Installs project dependencies.

### `removeDependency(name, options)`

Removes dependency from the project.

### `dedupeDependencies(options)`

Dedupe project dependencies.

> [!NOTE]
> For `bun` and `deno` it will remove the lockfile and reinstall all dependencies.

### `runScript(name, options)`

Runs a script defined in the `package.json` file.

### `dlx(package, options)`

Download and execute a package with the package manager.

### `installDependenciesCommand(<pm>, { short?, frozenLockFile? })`

Get the command to install dependencies with the package manager.

### `addDependencyCommand(<pm>, <name>, { dev?, global?, workspace?, yarnBerry?, short? })`

Get the command to add a dependency with the package manager.

### `runScriptCommand(<pm>, <name>, { args? })`

Get the command to run a script with the package manager.

### `dlxCommand(<pm>, <name>, { args?, short?, packages? })`

Get the command to download and execute a package with the package manager.

## 💻 Development

- Clone this repository
- Play [Nyan Cat](https://www.nyan.cat/) in the background (really important!)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`

## Related Projects

NYPM is inspired from previous attempts and projects for unifying package manager experience.

- [pi0/yarnpm](https://github.com/pi0/yarnpm)
- [unjs/lmify](https://github.com/unjs/lmify)
- [antfu/ni](https://github.com/antfu/ni)
- [antfu/install-pkg](https://github.com/antfu/install-pkg)
- [egoist/dum](https://github.com/egoist/dum)
- [nodejs/corepack](https://github.com/nodejs/corepack)

## License

Made with 💛

Published under [MIT License](./LICENSE).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/nypm?style=flat-square
[npm-version-href]: https://npmjs.com/package/nypm
[npm-downloads-src]: https://img.shields.io/npm/dm/nypm?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/nypm
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/unjs/nypm/ci.yml?branch=main&style=flat-square
[github-actions-href]: https://github.com/unjs/nypm/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/nypm/main?style=flat-square
[codecov-href]: https://codecov.io/gh/unjs/nypm

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