A Node.js module to resolve a path of the directory where npm CLI is installed
const npmCliDir = require('npm-cli-dir');
(async () => {
const dir = await npmCliDir(); //=> '/usr/local/lib/node_modules/npm'
})();
npm install npm-cli-dir
const npmCliDir = require('npm-cli-dir');
Return: Promise<string>
const {readdir} = require('fs').promises;
const npmCliDir = require('npm-cli-dir');
(async () => {
await readdir(await npmCliDir());
//=> ['.mailmap', '.npmignore', '.travis.yml', 'AUTHORS', 'CHANGELOG.md', ...]
})();
ISC License © 2017 - 2019 Watanabe Shinnosuke