Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

npm-install-checks

npm33.2mBSD-2-Clause7.1.1

Check the engines and platform fields in package.json

npm,, install

readme

npm-install-checks

Check the engines and platform fields in package.json

API

Both functions will throw an error if the check fails, or return undefined if everything is ok.

Errors have a required and current fields.

.checkEngine(pkg, npmVer, nodeVer, force = false)

Check if a package's engines.node and engines.npm match the running system.

force argument will override the node version check, but not the npm version check, as this typically would indicate that the current version of npm is unable to install the package properly for some reason.

Error code: 'EBADENGINE'

.checkPlatform(pkg, force, environment)

Check if a package's os, cpu and libc match the running system.

force argument skips all checks.

environment overrides the execution environment which comes from process.platform process.arch and current libc environment by default. environment.os environment.cpu and environment.libc are available.

Error code: 'EBADPLATFORM'

.checkDevEngines(wanted, current, opts)

Check if a package's devEngines property matches the current system environment.

Returns an array of Error objects, some of which may be warnings, this can be checked with .isError and .isWarn. Errors correspond to an error for a given "engine" failure, reasons for each engine "dependency" failure can be found within .errors.

changelog

Changelog

7.1.1 (2024-11-21)

Bug Fixes

  • acf64a7 #120 cache local environment values (#120) (@Tofandel)

    Chores

  • fca8f29 #119 bump @npmcli/template-oss from 4.23.3 to 4.23.4 (#119) (@dependabot[bot], @npm-cli-bot)

7.1.0 (2024-09-11)

Features

  • ebf9b9f #116 adds checkDevEngines (#116) (@reggi)

    Bug Fixes

  • ec4066b #118 skip network requests in report.getReport() (#118) (@wraithgar)

7.0.0 (2024-09-03)

⚠️ BREAKING CHANGES

  • npm-install-checks now supports node ^18.17.0 || >=20.5.0

    Bug Fixes

  • 0ac00b5 #114 align to npm 10 node engine range (@hashtagchris)

    Chores

  • 771bc19 #114 run template-oss-apply (@hashtagchris)
  • d7cf1dc #112 bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot])
  • 98057a0 #98 linting: no-unused-vars (@lukekarrys)
  • f1670ca #98 bump @npmcli/template-oss to 4.22.0 (@lukekarrys)
  • 06fdf5e #113 postinstall for dependabot template-oss PR (@hashtagchris)
  • 8b7cd81 #113 bump @npmcli/template-oss from 4.23.1 to 4.23.3 (@dependabot[bot])

6.3.0 (2023-10-06)

Features

  • 0419751 #71 allow checkPlatform to override execution libc (#71) (@Brooooooklyn)

6.2.0 (2023-08-07)

Features

  • 7a3f5ed #65 allow checkPlatform to override execution environment (#65) (@yukukotani)

6.1.1 (2023-04-12)

Bug Fixes

  • 7a93622 #57 typo glibcRuntimeVersion glibcVersionRuntime (#57) (@snyamathi)

6.1.0 (2023-03-21)

Features

  • 1b6f3e4 #54 support libc field checks (#54) (@nlf)

6.0.0 (2022-10-10)

⚠️ BREAKING CHANGES

  • npm-install-checks is now compatible with the following semver range for node: ^14.17.0 || ^16.13.0 || >=18.0.0

Features

  • f7c1276 #38 postinstall for dependabot template-oss PR (@lukekarrys)

5.0.0 (2022-04-05)

⚠ BREAKING CHANGES

  • this drops support for node 10 and non-LTS versions of node 12 and node 14

Dependencies

v4.0

  • Remove checkCycle and checkGit, as they are no longer used in npm v7
  • Synchronous throw-or-return API instead of taking a callback needlessly
  • Modernize code and drop support for node versions less than 10

v3 2016-01-12

  • Change error messages to be more informative.
  • checkEngine, when not in strict mode, now calls back with the error object as the second argument instead of warning.
  • checkCycle no longer logs when cycle errors are found.

v2 2015-01-20

  • Remove checking of engineStrict in the package.json