# reject-unsatisfied-npm-version

> Make a Promise rejection unless the currently installed npm CLI satisfies the required version

Latest version **1.0.0** (published 2018-07-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install reject-unsatisfied-npm-version
pnpm add reject-unsatisfied-npm-version
yarn add reject-unsatisfied-npm-version
bun add reject-unsatisfied-npm-version
```

## 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 | 2018-07-11 |
| First published | 2018-07-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Shinnosuke Watanabe |
| Maintainers | shinnn |
| Keywords | reject, rejection, refuse, promise, npm, version, semver, check, validate |

## Links

- npm: https://www.npmjs.com/package/reject-unsatisfied-npm-version
- Repository: https://github.com/shinnn/reject-unsatisfied-npm-version
- Homepage: https://github.com/shinnn/reject-unsatisfied-npm-version#readme
- Issues: https://github.com/shinnn/reject-unsatisfied-npm-version/issues
- npm.io page: https://npm.io/package/reject-unsatisfied-npm-version

## Dependencies (2)

- [npm-cli-version](https://npm.io/package/npm-cli-version.md) ^1.0.0
- [npm-version-compare](https://npm.io/package/npm-version-compare.md) ^1.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-07-11
- 0.0.1 — 2018-07-11
- 0.0.0 — 2018-07-10

## README

# reject-unsatisfied-npm-version

[![npm version](https://img.shields.io/npm/v/reject-unsatisfied-npm-version.svg)](https://www.npmjs.com/package/reject-unsatisfied-npm-version)
[![Build Status](https://travis-ci.com/shinnn/reject-unsatisfied-npm-version.svg?branch=master)](https://travis-ci.com/shinnn/reject-unsatisfied-npm-version)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/reject-unsatisfied-npm-version.svg)](https://coveralls.io/github/shinnn/reject-unsatisfied-npm-version)

[Make a `Promise` rejection](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject) unless the currently installed [npm CLI](https://github.com/npm/npm) satisfies the required version

```javascript
const rejectUnsatisfiedNpmVersion = require('reject-unsatisfied-npm-version');

// When `npm --version` prints `6.1.0`

(async () => {
  await rejectUnsatisfiedNpmVersion('6.0.0'); // not rejected
  await rejectUnsatisfiedNpmVersion('6.1.0'); // not rejected

  try {
    await rejectUnsatisfiedNpmVersion('6.2.0');
  } catch (err) {
    err.message; //=> 'Expected a version of npm CLI to be 6.2.0 or greater, but an older version 6.1.0 is installed. Run the command `npm install --global npm` to install the latest one.'
    err.code; //=> 'ERR_TOO_OLD_NPM'
  }
})();
```

Useful for applications and libraries which requires a newer version of `npm`.

## Installation

[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).

```
npm install reject-unsatisfied-npm-version
```

## API

```javascript
const rejectUnsatisfiedNpmVersion = require('reject-unsatisfied-npm-version');
```

### rejectUnsatisfiedNpmVersion(*requiredNpmVersion*)

*requiredNpmVersion*: `string` (minimum required `npm` version as a [SemVer](https://semver.org/#semantic-versioning-specification-semver) expression)  
Return: `Promise`

## License

[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe

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