This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
resolve-global 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.
Resolve the path of a globally installed module
$ npm install resolve-global
$ npm install --global cat-names
const resolveGlobal = require('resolve-global'); console.log(resolveGlobal('cat-names')); //=> '/usr/local/lib/node_modules/cat-names'
Throws if the module can't be found.
undefined instead of throwing if the module can't be found.
What you would use in
MIT © Sindre Sorhus