better-auth npm ERESOLVE 'peerOptional drizzle-kit@">=0.31.4 || >=1.0.0-beta.1" from better-auth@1.7.23' with drizzle-kit 0.27: upgrade drizzle-kit to 0.31 and drizzle-orm to 0.45
Fix: bump the drizzle packages to what better-auth declares: drizzle-kit >=0.31.4 (e.g. ^0.31.11) and drizzle-orm ^0.45.2 (e.g. ^0.45.4). With those, npm install resolves without --legacy-peer-deps.
Cause: better-auth 1.7.x lists drizzle-kit and drizzle-orm (and vitest ^2-^5, @tanstack/react-start, @tanstack/solid-start) as optional peers. Optional peers are ignored when absent, but once your project installs drizzle-kit, npm enforces the range, so an older template's drizzle-kit ^0.27 / drizzle-orm ^0.37 produces 'ERESOLVE could not resolve ... Found: drizzle-kit@0.27.2 ... Conflicting peer dependency: drizzle-kit@0.31.11'. A loose "better-auth": "^1.1.1" silently resolves to the latest 1.x, which is why an old tutorial's package.json stops installing.
Verified with npm install --package-lock-only in node:22-slim: better-auth ^1.1.1 + drizzle-orm ^0.37.0 + drizzle-kit ^0.27.2 fails as above; with drizzle-orm ^0.45.4 + drizzle-kit ^0.31.11 it resolves, also alongside vite 6 and a full SvelteKit 2 app. The absent @tanstack/react-start optional peer did not cause a conflict either. Check the current ranges with npm view better-auth peerDependencies. drizzle-kit 0.31 may produce different migration SQL than 0.27, so regenerate and review migrations after the bump.