prefer-pnpm
Use pnpm consistently and remove competing package-manager lockfiles.
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
{
"name": "my-astro-project"
}
# package-lock.json also existsCorrect
Declare pnpm and keep only its lockfile
{
"name": "my-astro-project",
"packageManager": "pnpm@10.34.3"
}
# pnpm-lock.yamlConfigure this check
Project audits are configured in doctor.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
- prefer-class-listUse class:list directive for conditional or dynamic class names.
- no-process-envDisallow process.env in Astro files — use import.meta.env instead.
- prefer-content-collectionsPrefer Content Collections over Astro.glob() or import.meta.glob() for Markdown and MDX files.
- no-legacy-astro-7-experimental-flagsMigrate experimental configuration fields removed or stabilized in Astro 7.
- prefer-env-schemaDefine an Astro env schema for variables documented in .env.example.
- require-client-router-script-lifecycleInitialize scripts on astro:page-load when using ClientRouter.
- require-content-configAdd a content config when src/content contains entries.
- require-fetch-default-exportRequire a default export from Astro 7 advanced-routing entrypoints.