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

Package detail

which-package-manager

mshima187.7kMIT1.0.1TypeScript support: included

Detect which package manager is used in the current project

pm, package-manager, yarn, npm, pnpm, lockfile, package-lock.json, yarn.lock

readme

which-package-manager

Detects the current package manager. Rules applied in order:

  • Lock file existence.
  • package.json structure compatibility.
  • packageManager field.
  • First compatible passed preferred package manager.

Usage

npm install which-package-manager
import { whichPackageManager } from 'which-package-manager';

const packageManager = await whichPackageManager();

License

MIT