# libnpmexec

> npm exec (npx) programmatic API

Latest version **11.0.2** (published 2026-07-29) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types package; no vulnerabilities; recently updated; high maintenance score; high quality score; popular repo.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 11.0.2 |
| Published | 2026-07-29 |
| First published | 2021-04-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/libnpmexec) |
| Module format | CommonJS |
| Node | ^22.22.2 \|\| ^24.15.0 \|\| >=26.0.0 |
| Dependencies | 12 |
| Unpacked size | 26 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10104 |
| Author | GitHub Inc. |
| Maintainers | saquibkhan, npm-cli-ops, reggi |
| Keywords | npm, npmcli, libnpm, cli, workspaces, libnpmexec |

## Links

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

## Dependencies (12)

- [read](https://npm.io/package/read.md) ^6.0.0
- [pacote](https://npm.io/package/pacote.md) ^22.0.0
- [semver](https://npm.io/package/semver.md) ^7.3.7
- [ci-info](https://npm.io/package/ci-info.md) ^4.0.0
- [proc-log](https://npm.io/package/proc-log.md) ^7.0.0
- [signal-exit](https://npm.io/package/signal-exit.md) ^4.1.0
- [walk-up-path](https://npm.io/package/walk-up-path.md) ^4.0.0
- [npm-package-arg](https://npm.io/package/npm-package-arg.md) ^14.0.0
- [@npmcli/arborist](https://npm.io/package/@npmcli/arborist.md) ^10.0.2
- [@gar/promise-retry](https://npm.io/package/@gar/promise-retry.md) ^1.0.0
- [@npmcli/run-script](https://npm.io/package/@npmcli/run-script.md) ^11.0.0
- [@npmcli/package-json](https://npm.io/package/@npmcli/package-json.md) ^8.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 11.0.2 (latest) — 2026-07-29
- 10.3.2 (backport) — 2026-07-29
- 11.0.0-pre.1 (prerelease) — 2026-06-29
- 11.0.1 — 2026-07-10
- 11.0.0 — 2026-07-08
- 10.3.1 — 2026-06-29
- 11.0.0-pre.0 — 2026-06-19
- 10.3.0 — 2026-06-11
- 10.2.9 — 2026-05-27
- 10.2.6-pre.0.0 — 2026-05-20
- 10.2.8 — 2026-05-20
- 10.2.7 — 2026-05-06
- 10.2.6 — 2026-04-22
- 9.0.5 — 2026-03-27
- 9.0.4 — 2026-03-18
- … 100 more at https://npm.io/package/libnpmexec/versions

## README

# libnpmexec

[![npm version](https://img.shields.io/npm/v/libnpmexec.svg)](https://npm.im/libnpmexec)
[![license](https://img.shields.io/npm/l/libnpmexec.svg)](https://npm.im/libnpmexec)
[![CI - libnpmexec](https://github.com/npm/cli/actions/workflows/ci-libnpmexec.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmexec.yml)

The `npm exec` (`npx`) Programmatic API

## Install

`npm install libnpmexec`

## Usage:

```js
const libexec = require('libnpmexec')
await libexec({
  args: ['yosay', 'Bom dia!'],
  cache: '~/.npm/_cacache',
  npxCache: '~/.npm/_npx',
  yes: true,
})
```

## API:

### `libexec(opts)`

- `opts`:
  - `args`: List of pkgs to execute **Array<String>**, defaults to `[]`
  - `call`: An alternative command to run when using `packages` option **String**, defaults to empty string.
  - `cache`: The path location to where the npm cache folder is placed **String**
  - `npxCache`: The path location to where the npx cache folder is placed **String**
  - `chalk`: Chalk instance to use for colors? **Required**
  - `localBin`: Location to the `node_modules/.bin` folder of the local project to start scanning for bin files **String**, defaults to `./node_modules/.bin`. **libexec** will walk up the directory structure looking for `node_modules/.bin` folders in parent folders that might satisfy the current `arg` and will use that bin if found.
  - `locationMsg`: Overrides "at location" message when entering interactive mode **String**
  - `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string.
  - `packages`: A list of packages to be used (possibly fetch from the registry) **Array<String>**, defaults to `[]`
  - `path`: Location to where to read local project info (`package.json`) **String**, defaults to `.`
  - `runPath`: Location to where to execute the script **String**, defaults to `.`
  - `scriptShell`: Default shell to be used **String**, defaults to `sh` on POSIX systems, `process.env.ComSpec` OR `cmd` on Windows
  - `yes`: Should skip download confirmation prompt when fetching missing packages from the registry? **Boolean**
  - `registry`, `cache`, and more options that are forwarded to [@npmcli/arborist](https://github.com/npm/cli/blob/latest/workspaces/arborist/README.md) and [pacote](https://github.com/npm/pacote/#options) **Object**

## LICENSE

[ISC](./LICENSE)

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