JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 193480
  • Score
    100M100P100Q163070F
  • License WTFPL

Check installed versions of node and npm

Package Exports

  • check-node-version

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (check-node-version) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

check-node-version

Check installed versions of node and npm.

Install

npm: check-node-version

npm install check-node-version

Command Line Usage

SYNOPSIS
      check-node-version [OPTIONS]

DESCRIPTION
      check-node-version will check if the current node and npm versions
      match the given semver version ranges.

      If the given version is not satisfied, information about
      installing the needed version is printed and the program exits
      with an error code.

OPTIONS

      --node VERSION
            Check that the current node version matches the given semver
            version range.

      --npm VERSION
            Check that the current npm version matches the given semver
            version range.

      -q, --quiet
            Don't output anything. Exit with an error code if the node
            or npm version is not satisfied, otherwise exit with code 0.

      -h, --help
            Print a usage message.

Examples

Get installed versions

When no versions are given, the current node and npm versions are printed out.

$ check-node-version
node: v0.12.7
npm: v2.14.10
$ echo $?
0

Check for node@4 and npm@2.14

$ check-node-version --node 4 --npm 2.14
node: v0.12.7
npm: v2.14.10
Error: Wanted node version "4" (>=4.0.0 <5.0.0)
To install node, run `nvm install 4` or check https://nodejs.org/
$ echo $?
1

Use with npm test

{
  "name": "my-package",
  "devDependencies": {
    "check-node-version": "^1.0.0"
  },
  "scripts": {
    "test": "check-node-version --node '>= 4.2.3' && node my-tests.js"
  }
}

API Usage

This module can also be used programmatically from node. See index.js and test.js for more information.n