Package · PKG0008
Install one copy of each singleton package
Read pnpm-lock.yaml and find workspace packages and apps whose install reaches two versions of the same major of a package the app must load once, such as vue, nuxt, nitro, h3, vite, react or drizzle-orm. Add packages with the singletons option.
Run this rule
pnpm vite-doctor . --extends package/recommended --rules package/no-duplicate-singleton
Why it matters
Two versions of a singleton are two module instances. Vue, Pinia, Nuxt and React keep their state per instance, so code from one copy cannot see the other's injections, stores or app context, and h3 and Drizzle reject objects created by the other copy. A lockfile resolves the second copy when one package pins a version or a range that excludes the app's.
Recommended fix
Update the package that resolves the extra version so it accepts the version the rest of the install uses, ideally as a peer, or add a pnpm override for that version and run pnpm install. Doctor reports each duplicate where it enters the workspace, at the package.json entry that leads to it.
Useful links
Example
Override a transitive pin to the app's Vue
Before
# pnpm-lock.yaml resolves vue 3.5.44 and, through old-ui, vue 3.4.0
After
# pnpm-workspace.yaml
overrides:
vue: 3.5.44