Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

resolve-global

sindresorhus9.3mMIT2.0.0TypeScript support: included

Resolve the path of a globally installed module

resolve, global, package, module, globally, path, npm, yarn, packages, require

readme

resolve-global

Resolve the path of a globally installed module

Install

npm install resolve-global

Usage

npm install --global cat-names
import {resolveGlobal} from 'resolve-global';

console.log(resolveGlobal('cat-names'));
//=> '/usr/local/lib/node_modules/cat-names'

API

resolveGlobal(moduleName)

Throws if the module cannot be found.

resolveGlobalSilent(moduleName)

Returns undefined instead of throwing if the module cannot be found.

moduleName

Type: string

What you would use in import().