# @antfu/install-pkg

> Install package programmatically.

Latest version **2.1.0** (published 2026-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @antfu/install-pkg
pnpm add @antfu/install-pkg
yarn add @antfu/install-pkg
bun add @antfu/install-pkg
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2026-09-15 |
| First published | 2021-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 2 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 206 |
| Author | Anthony Fu <anthonyfu117@hotmail.com> |
| Maintainers | antfu |

## Links

- npm: https://www.npmjs.com/package/@antfu/install-pkg
- Repository: https://github.com/antfu-collective/install-pkg
- Homepage: https://github.com/antfu-collective/install-pkg#readme
- Issues: https://github.com/antfu-collective/install-pkg/issues
- Funding: https://github.com/sponsors/antfu
- npm.io page: https://npm.io/package/@antfu/install-pkg

## Dependencies (2)

- [tinyexec](https://npm.io/package/tinyexec.md) ^1.3.1
- [package-manager-detector](https://npm.io/package/package-manager-detector.md) ^1.8.0

## Recent versions

- 2.1.0 (latest) — 2026-09-15
- 2.0.1 — 2026-07-21
- 1.1.0 — 2025-05-06
- 1.0.0 — 2025-01-09
- 0.5.0 — 2024-11-27
- 0.4.1 — 2024-08-26
- 0.4.0 — 2024-08-20
- 0.3.5 — 2024-08-15
- 0.3.4 — 2024-08-12
- 0.3.3 — 2024-04-25
- 0.3.2 — 2024-03-28
- 0.3.1 — 2023-12-01
- 0.3.0 — 2023-11-27
- 0.2.0 — 2023-11-21
- 0.1.1 — 2022-09-21
- … 2 more at https://npm.io/package/@antfu/install-pkg/versions

## README

# install-pkg

[![NPM version](https://img.shields.io/npm/v/@antfu/install-pkg?color=a1b858&label=)](https://www.npmjs.com/package/@antfu/install-pkg)

Install package programmatically. Detect package managers automatically (`npm`, `yarn`, `bun` and `pnpm`).

```bash
npm i @antfu/install-pkg
```

```ts
import { installPackage } from '@antfu/install-pkg'

await installPackage('vite', { silent: true })
```

## Sponsors

<p align="center">
  <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
    <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg' alt="Sponsors"/>
  </a>
</p>

## License

[MIT](./LICENSE) License © 2021 [Anthony Fu](https://github.com/antfu)

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