# node-version-checker

> Checks the current version of node against the `engines` property of package.json

Latest version **2.0.0** (published 2016-03-19) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install node-version-checker
pnpm add node-version-checker
yarn add node-version-checker
bun add node-version-checker
```

Provides the command `nvc`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2016-03-19 |
| First published | 2015-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 0.10.x |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Justin Dragos |
| Maintainers | caiges, ellisande, noahjs, opsatbold |
| Keywords | node, semver, checker |

## Links

- npm: https://www.npmjs.com/package/node-version-checker
- Repository: https://github.com/gobold/node-version-checker
- Issues: https://github.com/gobold/node-version-checker/issues
- npm.io page: https://npm.io/package/node-version-checker

## Dependencies (4)

- [yargs](https://npm.io/package/yargs.md) ^3.30.0
- [semver](https://npm.io/package/semver.md) ^5.1.0
- [shelljs](https://npm.io/package/shelljs.md) ^0.5.3
- [find-parent-dir](https://npm.io/package/find-parent-dir.md) ^0.3.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2016-03-19
- 1.0.6 — 2015-12-04
- 1.0.5 — 2015-12-04
- 1.0.4 — 2015-12-04
- 1.0.3 — 2015-12-04
- 1.0.2 — 2015-12-04
- 1.0.1 — 2015-12-04
- 1.0.0 — 2015-12-04

## README

# node-version-checker

Tool for checking if the current node version matches what is provided in the `enginges` section of the project's `package.json` file.

Main functionality:
* Attempts to find a package.json in the current directory or one of its ancestors.
* If package.json is found compare the current version of node with the version specified in the package.json
* If the current version of node does not satisfy the version from package.json throw an error.
* If the current version of node *does* satisfy the version from package.json print a friendly message that everything is ok.

Options:
* loose instead of checking semver.satisfies checks only if the current version is greater than the requested version
* switch if the versions do not match attempt to use the `n` package manager to switch to a compliant node version

## install

Easy command line usage:
`npm install -g node-version-checker`

Dev dependency:
`npm install node-version-checker --save-dev`

## Command Line Usage
```shell
Usage: nvc [options]

Options:
  --loose   Check only that the current node version is greater the required
            engine version
  --switch  If the node version doesn't satisfy the engine version attempt to
            use the n pacakage manager to switch the current node version to a
            compliant version.
  -h        Show help                                                  [boolean]
```

## Node Usage
Just require checker and then invoke it.

```js
//Require syntax
var checker = require('node-version-checker').default;
//import syntax
import checker from 'node-version-checker';
```

Checker will throw an error if the versions don't match the rules. You can optionally pass in an options object to modify behavior:

```js
//Check with default options
checker()
//Check with options provided.
checker({loose: true, switch: false});
```

### Node Options
You can specify the following options when using through node:
```js
const options = {
  //Check only that the current node version is greater the required engine version when set to true.
  //Default is false.
  loose: true || false,
  //If the node version doesn't satisfy the engine version attempt to use the n pacakage manager to switch the current node version to compliant version.
  //Default is false
  switch: true || false
}
```

## Package.json script

```json
{
  "scripts": {
    "checkVer": "node node_modules/node-version-checker"
  }
}
```

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