Skip to contentView the source on GitHub

prefer-pnpm

Use pnpm consistently and remove competing package-manager lockfiles.

Best Practiceswarning by default Project auditopt-in audit

astro-doctor/prefer-pnpm

Why it matters

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.

See the difference

Incorrect

Package manager is unspecified or competing lockfiles exist

jsonIncorrect example
{
  "name": "my-astro-project"
}

# package-lock.json also exists

Correct

Declare pnpm and keep only its lockfile

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

# pnpm-lock.yaml

Configure this check

Project audits are configured in doctor.config.ts:

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

Use 'error', 'warn', or 'off'. The configuration guide covers presets and per-file overrides.

Keep exploring best practices

Browse every rule and project audit