This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 1,000,000+ packages pre-installed, including
is-installed-globally with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Check if your package was installed globally
Can be useful if your CLI needs different behavior when installed globally and locally.
$ npm install is-installed-globally
const isInstalledGlobally = require('is-installed-globally'); // With `npm install your-package` console.log(isInstalledGlobally); //=> false // With `npm install --global your-package` console.log(isInstalledGlobally); //=> true