Skip to content
Best Practiceswarn by defaultopt-in presetastro-doctor/prefer-pnpm

prefer-pnpm

Use pnpm consistently and remove competing package-manager lockfiles.

Why

Declaring pnpm in packageManager makes local development and CI use the same package-manager version. Keeping npm, Yarn, or Bun lockfiles alongside pnpm-lock.yaml can produce different dependency graphs and non-reproducible installs.

Examples

Incorrect

Package manager is unspecified or competing lockfiles exist

json
{
  "name": "my-astro-project"
}

# package-lock.json also exists

Correct

Declare pnpm and keep only its lockfile

json
{
  "name": "my-astro-project",
  "packageManager": "pnpm@10.34.3"
}

# pnpm-lock.yaml

Configuration

Project audits are configured in doctor.config.ts:

typescriptdoctor.config.ts
export default {
            rules: {
              'astro-doctor/prefer-pnpm': 'error', // or 'warn' or 'off'
            },
          }

All rules