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

Package detail

npm-cli-version

shinnn6.1kISC1.0.0

Get the currently installed npm CLI version

npm, cli, version, command, semver, string, promise, async

readme

npm-cli-version

npm version Build Status Build status Coverage Status

Get the currently installed npm CLI version

const npmCliVersion = require('npm-cli-version');

(async () => {
  await npmCliVersion(); //=> '5.5.1'
})();

Unlike the prior arts, it doesn't execute npm --version in a child process.

Installation

Use npm.

npm install npm-cli-version

API

const npmCliVersion = require('npm-cli-version');

npmCliVersion()

Return: Promise<string>

License

ISC License © 2018 Shinnosuke Watanabe