[GH-ISSUE #6834] npm install fails with MongoDB 7 due to strict peer dependency (^6.18.0) #19278

Closed
opened 2026-04-15 18:09:35 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @xsujit on GitHub (Dec 17, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6834

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. npm i mongodb
  2. npm i better-auth

Note: npm i better-auth@1.4.5 works fine.

Current vs. Expected behavior

Current behavior

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: better-auth@1.4.7
npm error Found: mongodb@7.0.0
npm error node_modules/mongodb
npm error mongodb@"^7.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional mongodb@"^6.18.0" from better-auth@1.4.7
npm error node_modules/better-auth
npm error better-auth@"^1.4.7" from the root project

Expected behavior
Install should be successful. This was working fine till better-auth v1.4.5.

What version of Better Auth are you using?

1.4.6

System info

{
  "system": {
    "platform": "win32",
    "arch": "x64",
    "version": "Windows 11 Pro",
    "release": "10.0.26200",
    "cpuCount": 12,
    "cpuModel": "AMD Ryzen 5 5600X 6-Core Processor             ",
    "totalMemory": "31.91 GB",
    "freeMemory": "16.22 GB"
  },
  "node": {
    "version": "v22.21.1",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "10.9.4"
  },
  "frameworks": null,
  "databases": [
    {
      "name": "mongodb",
      "version": "^7.0.0"
    }
  ],
  "betterAuth": {
    "version": "^1.4.7",
    "config": null
  }
}

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

Backend

Auth config (if applicable)


Additional context

No response

Originally created by @xsujit on GitHub (Dec 17, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6834 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. npm i mongodb 2. npm i better-auth Note: npm i better-auth@1.4.5 works fine. ### Current vs. Expected behavior Current behavior > npm error code ERESOLVE npm error ERESOLVE could not resolve npm error npm error While resolving: better-auth@1.4.7 npm error Found: mongodb@7.0.0 npm error node_modules/mongodb npm error mongodb@"^7.0.0" from the root project npm error npm error Could not resolve dependency: npm error peerOptional mongodb@"^6.18.0" from better-auth@1.4.7 npm error node_modules/better-auth npm error better-auth@"^1.4.7" from the root project Expected behavior Install should be successful. This was working fine till better-auth v1.4.5. ### What version of Better Auth are you using? 1.4.6 ### System info ```bash { "system": { "platform": "win32", "arch": "x64", "version": "Windows 11 Pro", "release": "10.0.26200", "cpuCount": 12, "cpuModel": "AMD Ryzen 5 5600X 6-Core Processor ", "totalMemory": "31.91 GB", "freeMemory": "16.22 GB" }, "node": { "version": "v22.21.1", "env": "development" }, "packageManager": { "name": "npm", "version": "10.9.4" }, "frameworks": null, "databases": [ { "name": "mongodb", "version": "^7.0.0" } ], "betterAuth": { "version": "^1.4.7", "config": null } } ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-15 18:09:35 -05:00
Author
Owner

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

It looks like the issue stems from Better Auth v1.4.7 declaring an optional peer dependency on a mongodb version in the 6.x range, which conflicts with mongodb 7.0.0. As a workaround, you might consider one of the following approaches:

• Downgrade your mongodb package to a 6.x version (for example, ^6.18.0) so that the peer dependency requirement is met.
• Use an npm flag like --legacy-peer-deps on install to bypass strict peer dependency resolution.
• Alternatively, if you require mongodb 7 features, you might temporarily revert to Better Auth v1.4.5 (which worked successfully) until an update addressing compatibility is released.

Does using one of these options suit your current setup, or would you like more details on adjusting your dependency configuration? 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:3666847731 --> @better-auth-agent[bot] commented on GitHub (Dec 17, 2025): It looks like the issue stems from Better Auth v1.4.7 declaring an optional peer dependency on a mongodb version in the 6.x range, which conflicts with mongodb 7.0.0. As a workaround, you might consider one of the following approaches: • Downgrade your mongodb package to a 6.x version (for example, ^6.18.0) so that the peer dependency requirement is met. • Use an npm flag like --legacy-peer-deps on install to bypass strict peer dependency resolution. • Alternatively, if you require mongodb 7 features, you might temporarily revert to Better Auth v1.4.5 (which worked successfully) until an update addressing compatibility is released. Does using one of these options suit your current setup, or would you like more details on adjusting your dependency configuration? 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)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19278