# cross-npm-spawn

> Cross-platform NPM spawn

Latest version **1.1.1** (published 2016-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install cross-npm-spawn
pnpm add cross-npm-spawn
yarn add cross-npm-spawn
bun add cross-npm-spawn
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2016-06-17 |
| First published | 2016-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Leeroy Brun |
| Maintainers | leeroy |
| Keywords | npm, spawn, spawn npm, npm spawn, npm programmatically, cross platform |

## Links

- npm: https://www.npmjs.com/package/cross-npm-spawn
- Repository: https://github.com/leeroybrun/cross-npm-spawn
- Homepage: https://github.com/leeroybrun/cross-npm-spawn#readme
- Issues: https://github.com/leeroybrun/cross-npm-spawn/issues
- npm.io page: https://npm.io/package/cross-npm-spawn

## Dependencies (2)

- [dargs](https://npm.io/package/dargs.md) ^4.1.0
- [cross-spawn](https://npm.io/package/cross-spawn.md) ^4.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2016-06-17
- 1.1.0 — 2016-06-17
- 1.0.4 — 2016-06-16
- 1.0.3 — 2016-06-16
- 1.0.2 — 2016-06-16
- 1.0.1 — 2016-06-16
- 1.0.0 — 2016-06-16

## README

# cross-npm-spawn
Cross-platform NPM spawn

## Installation

```
npm install cross-npm-spawn
```

## Usage

### `spawnNpm(command, npmArgs, spawnArgs)`

#### Params
- **String** `command`: The npm command (e.g. `'install'`).
- **Object** `npmArgs`: An object parsed by [`dargs`](https://www.npmjs.com/package/dargs).
- **Object|String** `spawnArgs`: The spawn options object or just the working directory where to run the command.

#### Return
- **Promise** A promise that if resolved will returns an object with the following properties :

```
{
  code: Integer,  // Return code of the NPM command. 0 if success, 1 if an error occured
  stdout: String, // stdout of the NPM command
  stderr: String  // stderr of the NPM command
}
```

## Example

    const spawnNpm = require('cross-npm-spawn');

    // Will execute the "npm show express version" command
    const promise = spawnNpm('show', {_: ['express', 'version']}).then((result) => {
      console.log('Return code : ', result.code);
      console.log('Stdout : ', result.stdout);
      console.log('Stderr : ', result.stderr);
    }).catch((reason) => {
      console.log('An error occured while executing the NPM command.', reason);
    });

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