1.0.0 • Published 6 years ago
npm-cli-version v1.0.0
npm-cli-version
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
npm install npm-cli-version
API
const npmCliVersion = require('npm-cli-version');
npmCliVersion()
Return: Promise<string>
Related projects
- parse-npm-version — Similar to this module, but returns a
Promise
for a node-semver object instead - npm-cli-dir — Resolve the directory path where
npm
CLI is installed. Used by this module.
License
ISC License © 2018 Shinnosuke Watanabe