[GH-ISSUE #6872] drizzle-orm peerOptional issue #10659

Closed
opened 2026-04-13 06:55:43 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @jaredhan418 on GitHub (Dec 19, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6872

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

npm i better-auth@1.4.7

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: better-auth@1.4.7
npm error Found: drizzle-orm@0.45.1
npm error node_modules/drizzle-orm
npm error   drizzle-orm@"^0.45.1" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional drizzle-orm@"^0.41.0" from better-auth@1.4.7
npm error node_modules/better-auth
npm error   better-auth@"1.4.7" from the root project
npm error   peer better-auth@"1.4.7" from @better-auth/passkey@1.4.7
npm error   node_modules/@better-auth/passkey
npm error     @better-auth/passkey@"1.4.7" from the root project
npm error
npm error Conflicting peer dependency: drizzle-orm@0.41.0

Current vs. Expected behavior

expect install success

What version of Better Auth are you using?

1.4.7

System info

macos

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

Under the Semantic Versioning (SemVer) specification, the version range ^0.a.b only matches patch versions with the same minor version (a) under the same major version (0). That is, ^0.41.0 is equivalent to the range 0.41.0 <= version < 0.42.0.

Originally created by @jaredhan418 on GitHub (Dec 19, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6872 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce npm i better-auth@1.4.7 ``` npm error code ERESOLVE npm error ERESOLVE could not resolve npm error npm error While resolving: better-auth@1.4.7 npm error Found: drizzle-orm@0.45.1 npm error node_modules/drizzle-orm npm error drizzle-orm@"^0.45.1" from the root project npm error npm error Could not resolve dependency: npm error peerOptional drizzle-orm@"^0.41.0" from better-auth@1.4.7 npm error node_modules/better-auth npm error better-auth@"1.4.7" from the root project npm error peer better-auth@"1.4.7" from @better-auth/passkey@1.4.7 npm error node_modules/@better-auth/passkey npm error @better-auth/passkey@"1.4.7" from the root project npm error npm error Conflicting peer dependency: drizzle-orm@0.41.0 ``` ### Current vs. Expected behavior expect install success ### What version of Better Auth are you using? 1.4.7 ### System info ```bash macos ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context Under the Semantic Versioning (SemVer) specification, the version range ^0.a.b only matches patch versions with the same minor version (a) under the same major version (0). That is, ^0.41.0 is equivalent to the range 0.41.0 <= version < 0.42.0.
GiteaMirror added the locked label 2026-04-13 06:55:43 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Dec 19, 2025):

(tag @better-auth-agent if you would like an answer from the Agent)

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3673371818 --> @better-auth-agent[bot] commented on GitHub (Dec 19, 2025): (tag @better-auth-agent if you would like an answer from the Agent) _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Author
Owner

@dosubot[bot] commented on GitHub (Dec 19, 2025):

The npm ERESOLVE error happens because better-auth@1.4.7 declares a peer dependency on drizzle-orm with the version range ^0.41.0, which only matches 0.41.x releases. Since you have drizzle-orm@0.45.1, npm sees this as incompatible and blocks the install, even though the dependency is marked as optional. This is due to how npm interprets ^0.x.y ranges under SemVer rules—^0.41.0 means >=0.41.0 and <0.42.0, so it excludes 0.45.x details.

Workarounds: you can install with npm --force or --legacy-peer-deps to bypass the check, use pnpm (which is more lenient with optional peers), or downgrade drizzle-orm to a supported 0.41.x version. Be aware that bypassing the peer check may risk unsupported setups if drizzle-orm introduces breaking changes, so test thoroughly discussion.

A fix has already been merged to relax the peer dependency to >=0.41.0, which will allow newer versions like 0.45.1 to install cleanly in the next better-auth release PR #6771.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

<!-- gh-comment-id:3673374812 --> @dosubot[bot] commented on GitHub (Dec 19, 2025): <!-- Answer --> The npm ERESOLVE error happens because better-auth@1.4.7 declares a peer dependency on drizzle-orm with the version range ^0.41.0, which only matches 0.41.x releases. Since you have drizzle-orm@0.45.1, npm sees this as incompatible and blocks the install, even though the dependency is marked as optional. This is due to how npm interprets ^0.x.y ranges under SemVer rules—^0.41.0 means >=0.41.0 and <0.42.0, so it excludes 0.45.x [details](https://github.com/better-auth/better-auth/issues/6765). Workarounds: you can install with npm --force or --legacy-peer-deps to bypass the check, use pnpm (which is more lenient with optional peers), or downgrade drizzle-orm to a supported 0.41.x version. Be aware that bypassing the peer check may risk unsupported setups if drizzle-orm introduces breaking changes, so test thoroughly [discussion](https://github.com/better-auth/better-auth/issues/6778). A fix has already been merged to relax the peer dependency to >=0.41.0, which will allow newer versions like 0.45.1 to install cleanly in the next better-auth release [PR #6771](https://github.com/better-auth/better-auth/pull/6771). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/e33eaabf-b6f6-4a96-b607-828fd1f74561?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e33eaabf-b6f6-4a96-b607-828fd1f74561?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e33eaabf-b6f6-4a96-b607-828fd1f74561?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e33eaabf-b6f6-4a96-b607-828fd1f74561?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e33eaabf-b6f6-4a96-b607-828fd1f74561?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e33eaabf-b6f6-4a96-b607-828fd1f74561?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e33eaabf-b6f6-4a96-b607-828fd1f74561?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20npm%20ERESOLVE%20error%20happens%20because%20better-auth%401.4.7%20declares%20a%20peer%20dependency%20on%20drizzle-orm%20with%20the%20version%20range%20%5E0.41.0%2C%20which%20only%20matches%200.41.x%20releases.%20Since%20you%20have%20drizzle-orm%400.45.1%2C%20npm%20sees%20this%20as%20incompatible%20and%20blocks%20the%20install%2C%20even%20though%20the%20dependency%20is%20marked%20as%20optional.%20This%20is%20due%20to%20how%20npm%20interprets%20%5E0.x.y%20ranges%20under%20SemVer%20rules%E2%80%94%5E0.41.0%20means%20%3E%3D0.41.0%20and%20%3C0.42.0%2C%20so%20it%20excludes%200.45.x%C2%A0%5Bdetails%5D%28https%3A//github.com/better-auth/better-auth/issues/6765%29.%0A%0AWorkarounds%3A%20you%20can%20install%20with%20npm%20--force%20or%20--legacy-peer-deps%20to%20bypass%20the%20check%2C%20use%20pnpm%20%28which%20is%20more%20lenient%20with%20optional%20peers%29%2C%20or%20downgrade%20drizzle-orm%20to%20a%20supported%200.41.x%20version.%20Be%20aware%20that%20bypassing%20the%20peer%20check%20may%20risk%20unsupported%20setups%20if%20drizzle-orm%20introduces%20breaking%20changes%2C%20so%20test%20thoroughly%C2%A0%5Bdiscussion%5D%28https%3A//github.com/better-auth/better-auth/issues/6778%29.%0A%0AA%20fix%20has%20already%20been%20merged%20to%20relax%20the%20peer%20dependency%20to%20%3E%3D0.41.0%2C%20which%20will%20allow%20newer%20versions%20like%200.45.1%20to%20install%20cleanly%20in%20the%20next%20better-auth%20release%C2%A0%5BPR%20%236771%5D%28https%3A//github.com/better-auth/better-auth/pull/6771%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/6872)
Author
Owner

@himself65 commented on GitHub (Dec 19, 2025):

Could you please try 1.4.8-beta.1?

<!-- gh-comment-id:3673596316 --> @himself65 commented on GitHub (Dec 19, 2025): Could you please try 1.4.8-beta.1?
Author
Owner

@himself65 commented on GitHub (Dec 19, 2025):

Fixed in 5d26a54595

<!-- gh-comment-id:3673604429 --> @himself65 commented on GitHub (Dec 19, 2025): Fixed in https://github.com/better-auth/better-auth/commit/5d26a5459501d566154dfbefe72fc82e83c4a0c5
Author
Owner

@chengfengfengwang commented on GitHub (Dec 19, 2025):

Fixed in 5d26a54

need npm i better-auth@1.4.8-beta.1?

<!-- gh-comment-id:3674274747 --> @chengfengfengwang commented on GitHub (Dec 19, 2025): > Fixed in [5d26a54](https://github.com/better-auth/better-auth/commit/5d26a5459501d566154dfbefe72fc82e83c4a0c5) need `npm i better-auth@1.4.8-beta.1`?
Author
Owner

@jaredhan418 commented on GitHub (Dec 19, 2025):

IMO, we should add >=0.41.0 <1.0.0, Because drizzle will release 1.0 very soon and it has break changes.

<!-- gh-comment-id:3674561306 --> @jaredhan418 commented on GitHub (Dec 19, 2025): IMO, we should add `>=0.41.0 <1.0.0`, Because drizzle will release 1.0 very soon and it has break changes.
Author
Owner

@himself65 commented on GitHub (Dec 19, 2025):

Fixed in 5d26a54

need npm i better-auth@1.4.8-beta.1?

yes

<!-- gh-comment-id:3674680323 --> @himself65 commented on GitHub (Dec 19, 2025): > > Fixed in [5d26a54](https://github.com/better-auth/better-auth/commit/5d26a5459501d566154dfbefe72fc82e83c4a0c5) > > need `npm i better-auth@1.4.8-beta.1`? yes
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10659