# engine-check

> Enforce node engine version from package.json

Latest version **1.0.1** (published 2017-12-05) · ISC license · 0 weekly downloads

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

## Install

```sh
npm install engine-check
pnpm add engine-check
yarn add engine-check
bun add engine-check
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-12-05 |
| First published | 2016-02-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/engine-check) |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Peter-Paul |
| Maintainers | ppvg |
| Keywords | node, npm, engines, engine, version, engine version, version check, engine version check |

## Links

- npm: https://www.npmjs.com/package/engine-check
- Repository: https://github.com/ppvg/node-engine-check
- Homepage: https://github.com/ppvg/node-engine-check#readme
- Issues: https://github.com/ppvg/node-engine-check/issues
- npm.io page: https://npm.io/package/engine-check

## Dependencies (1)

- [semver](https://npm.io/package/semver.md) ^5.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

- 1.0.1 (latest) — 2017-12-05
- 1.0.0 — 2016-02-26

## README

# Node engine check

This is a drop-in module to enforce the node engine version specified in your
project's package.json.

## Usage

Add an ["engines" section](https://docs.npmjs.com/files/package.json#engines)
to your `package.json`, if you don't have it already.

```json
{
  "name": "my-app",
  ...
  "engines": {
    "node": ">=4.0"
  }
}
```

Add this to the entry point of your node app:

```javascript
// index.js
require('engine-check')()
console.log('Hello node >=4.0!')
```

And then run your app with the correct version of node:

```text
bash$ node -v
v4.3.1

bash$ node index.js
Hello node >=4.0!

bash$ echo $?
0
```

Or with an outdated one:

```text
bash$ node -v
v0.12.10

bash$ node index.js
Detected node version: 0.12.10. Required node version: >=4.0.

bash$ echo $?
1
```

Note: the warning is sent to STDERR. If you'd rather not have any output, you
can set the `silent` option:

```javascript
// index.js
require('engine-check')({ silent: true })
console.log('Hello node >=4.0!')
```

```text
bash$ node -v
v0.12.10

bash$ node index.js

bash$ echo $?
1
```


### Available options

- **`silent`** (default: `false`)
  - when `true`, completely disables all STDERR output
- **`debug`** (default: `false`)
  - when `true`, STDERR output becomes more verbose
- **`searchRoot`** (default: the dirname of the main module)
  - where to start searching for the project's `package.json`
  - **use with caution**

## Caveats

Currently only the `"node"` engine is checked.

## License

Copyright (c) 2016, Peter-Paul van Gemerden.
Distributed under the ISC license (see the `LICENSE` file).

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