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.
npm install npm-cli-version
const npmCliVersion = require('npm-cli-version');
Return: Promise<string>
- 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.
ISC License © 2018 - 2019 Shinnosuke Watanabe