# pmex

> Run dynamic NPM or YARN or PNPM

Latest version **2.0.15** (published 2025-12-20) · MIT license · 0 weekly downloads

## Install

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

Provides the command `pmex`.

## Health

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

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.15 |
| Published | 2025-12-20 |
| First published | 2023-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Caio Teixeira |
| Maintainers | caioedut |
| Keywords | node, npm, yarn, pnpm, bun, npx, bunx |

## Links

- npm: https://www.npmjs.com/package/pmex
- Repository: https://github.com/caioedut/pmex
- Homepage: https://github.com/caioedut/pmex#readme
- Issues: https://github.com/caioedut/pmex/issues
- npm.io page: https://npm.io/package/pmex

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.0.15 (latest) — 2025-12-20
- 2.0.10 — 2025-09-05
- 2.0.9 — 2024-08-15
- 2.0.8 — 2024-06-18
- 2.0.7 — 2024-06-12
- 2.0.6 — 2024-05-31
- 2.0.5 — 2024-05-31
- 2.0.4 — 2024-05-31
- 2.0.3 — 2024-05-31
- 2.0.2 — 2024-05-23
- 2.0.1 — 2024-05-23
- 1.1.0 — 2024-05-22
- 1.0.9 — 2024-05-22
- 1.0.8 — 2024-05-22
- 1.0.7 — 2024-05-15
- … 7 more at https://npm.io/package/pmex/versions

## README

# Package Manager Execute

Dynamically selects NPM or YARN or PNPM or BUN to execute commands.

```shell
pmex [...command]
```

## CLI

### Auto Selection
Runs  `npm install` or `yarn install` or `pnpm install` or `bun install` based on most recent LOCKFILE.

```shell
pmex install
```

## Defined Commands

### `add`

Add packages to the project.

```bash
pmex add typescript

# npm install typescript
# yarn add typescript
# pnpm add typescript
# bun add typescript
```

### `del`

Remove packages from project.

Aliases: `remove`, `uninstall`.

```bash
pmex del typescript

# npm uninstall typescript
# yarn remove typescript
# pnpm remove typescript
# bun remove typescript
```

### `x`

Aliases: `dlx`.

Auto-install (no save) and run packages from NPM.

```bash
pmex x cowsay "Hello World!"

# npx cowsay "Hello World!"
# yarn dlx cowsay "Hello World!"
# pnpm dlx cowsay "Hello World!"
# bunx cowsay "Hello World!"
```

### `cc`

Aliases: `cache-clean`, `cache-clear`.

Clear the package manager cache.

```bash
pmex cc

# npm cache clean --force
# yarn cache clean --all
# pnpm store prune
# bun pm cache rm
```

## Scripting

This example runs `npm install` or `yarn install` or `pnpm install` or `bun install` based on what you used in the terminal: `yarn start` or `npm start` or `pnpm start`  or `bun start`.

```json
{
  "scripts": {
    "prestart": "pmex install",
    "start": "node server.js"
  }
}
```

### Runtime

This example runs commands based on what you used to run the file.

```js
import pmex from 'pmex';

// Different command based on package manager
pmex({
  npm: 'cache clean --force',
  yarn: 'cache clean --all',
  pnpm: 'store prune',
  bun: 'pm cache rm -g'
})

// Fallback to default
pmex({
  bun: 'bunx cowsay "Hello World!"',
  default: 'npx cowsay "Hello World!"'
})

pmex('test')

pmex('tsc --noEmit')

pmex('build')
```

### Override

You can force the use of a package manager. This example runs `npm install` for all package managers and then runs `tsc` with automatic detection of the package manager.

```js
import pmex from 'pmex';

pmex('npm install -g tsc')

pmex('tsc --noEmit')
```

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