# @springernature/util-package-installer

> Dynamically installs NPM packages

Latest version **1.0.0** (published 2022-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @springernature/util-package-installer
pnpm add @springernature/util-package-installer
yarn add @springernature/util-package-installer
bun add @springernature/util-package-installer
```

## 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.0.0 |
| Published | 2022-04-05 |
| First published | 2019-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jpw |
| Maintainers | benjclark, sonniesedge, rlau, dotcode, joseluisbolos, hollsk, moddular, jpw, nickcall, howlingmad, sndigital, davidpauljunior, morgaan, nasiamakryg |
| Keywords | springernature, npm, install, installer |

## Links

- npm: https://www.npmjs.com/package/@springernature/util-package-installer
- Repository: https://github.com/springernature/frontend-toolkit-utilities
- Homepage: https://github.com/springernature/frontend-toolkit-utilities#readme
- Issues: https://github.com/springernature/frontend-toolkit-utilities/issues
- npm.io page: https://npm.io/package/@springernature/util-package-installer

## Dependencies (2)

- [validate-npm-package-name](https://npm.io/package/validate-npm-package-name.md) ^3.0.0
- [@springernature/util-cli-reporter](https://npm.io/package/@springernature/util-cli-reporter.md) ^2.0.0

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-04-05
- 0.5.0 — 2022-04-04
- 0.4.0 — 2022-01-06
- 0.3.1 — 2021-09-08
- 0.3.0 — 2020-09-24
- 0.2.2 — 2019-09-25
- 0.2.1 — 2019-09-25
- 0.1.0 — 2019-09-24

## README

# Package Installer

[![NPM version][badge-npm]][info-npm]
[![Node version][badge-node]][info-node]
![MIT License][badge-license]

This package allows dynamic installation of other NPM packages.

Internally it uses node's `child_process.spawn` because the recommended way of installing
node modules dynamically is to use `npm` directly.

It has one dependency and is intended to be as light as possible.

It does not accept `npm` v1-style package names. If you don't know what they are,
don't worry because they are old :)

## Sample, simple usage (async/await style)

The general idea is to pass it a `JSON.parse`d `package.json`;
It will either return `stdout`, or throw an `Error`.

```
const install = require('@springernature/util-package-installer');
const packageJSON = require('./path/to/package.json');
(async () => {
    let installResult;
    try {
        installResult = await install.dependencies(packageJSON);
        console.log(`npm install stdout: ${installResult}`);
    } catch (error) {
        console.log(`npm install stderr: ${error}`);
    }
})();
```
There are also helper methods to install just `devDependencies` or `peerDependencies`,
please see the [full documentation in this repo](docs/index.html).

## License

[MIT License][info-license] &copy; 2019, Springer Nature

[info-npm]: https://www.npmjs.com/package/@springernature/util-package-installer
[badge-npm]: https://img.shields.io/npm/v/@springernature/util-package-installer.svg
[info-license]: https://github.com/springernature/frontend-toolkit-utilities/blob/master/LICENCE
[badge-license]: https://img.shields.io/badge/license-MIT-blue.svg
[badge-node]: https://img.shields.io/badge/node->=8-brightgreen.svg
[info-node]: package.json

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