Package managers
pkgr runs the command you would have typed. Choosing the right tool is the whole job, so the rules are short and fixed.
For package.json
Section titled “For package.json”In order:
-
The
packageManagerfield, if it names a known tool. This is the Corepack format, e.g."packageManager": "pnpm@9.1.0"givespnpm. Known names arenpm,pnpm,yarnandbun. -
A lockfile next to the manifest, checked in this order:
Lockfile Tool pnpm-lock.yamlpnpmyarn.lockyarnbun.lockbunbun.lockbbunpackage-lock.jsonnpm -
npm, as the fallback.
An unrecognised packageManager value (say "foo@1") is ignored and detection falls through to the lockfile rather than producing a command that cannot run.
The command is always <tool> run <task>.
For Deno
Section titled “For Deno”deno.json and deno.jsonc always run as:
deno task <task>Lockfiles are ignored.
Seeing the decision
Section titled “Seeing the decision”pkgr prints the resolved command to stderr just before it runs, so you always see what was chosen:
> pnpm run buildIf the wrong tool is chosen, set packageManager in package.json. That is the one source pkgr trusts above all others.
Support the project: Buy Me a Coffee or GitHub Sponsors.