nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
24.96k stars 3.52k forks source link

Incorrect Peer Dependency #6565

Closed Tsabary closed 1 year ago

Tsabary commented 1 year ago

Adapter type

@next-auth/mongodb-adapter

Environment

When running the command `npm install mongodb next-auth @next-auth/mongodb-adapter@next this is what I get.


npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.2" from next-auth@4.0.0-beta.4
npm ERR! node_modules/next-auth
npm ERR!   next-auth@"*" from the root project
npm ERR!   peer next-auth@">4 || 4.0.0-beta.1 - 4.0.0-beta.x" from @next-auth/mongodb-adapter@0.0.2-next.298
npm ERR!   node_modules/@next-auth/mongodb-adapter
npm ERR!     @next-auth/mongodb-adapter@"0.0.2-next.298" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Yanay\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Yanay\AppData\Local\npm-cache\_logs\2023-01-30T13_29_25_610Z-debug-0.log```

### Reproduction URL

Don't have a repo to post as it's a private project, but the issue is in installing anyway

### Describe the issue

It just doesn't install the dependencies properly. I ended up installing it with --legacy-peer-deps, but tbh I'm not knowledgeable enough to know what are the repercussions of doing so, just know it's not ideal.

### How to reproduce

Just try to run the command

### Expected behavior

Should just install with no issues
github-actions[bot] commented 1 year ago

We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate.

Why was this issue marked with the incomplete label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository (template), but you can also use a tool like CodeSandbox or StackBlitz.

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue.

Please test your reproduction against the latest version of NextAuth.js (next-auth@latest) to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

What happens if I don't provide a sufficient minimal reproduction?

Issues with the incomplete label that receives no meaningful activity (e.g. new comments with a reproduction link) are automatically closed and locked after 30 days.

If your issue has not been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the :+1: reaction on the topmost comment (please do not comment "I have the same issue" without repro steps). Then, we can sort issues by votes to prioritize.

I think my reproduction is good enough, why aren't you looking into it quicker?

We look into every NextAuth.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

chilltemp commented 1 year ago

I think the problem here is installing @next-auth/mongodb-adapter@next instead of @next-auth/mongodb-adapter. The @next package is very old.

  "dist-tags": {
    "experimental": "0.0.2-pr.274-8c5c0fd1.289",
    "latest": "1.1.1",
    "next": "0.0.2-next.298"
  },
theMistDev commented 1 year ago

I think the problem here is installing @next-auth/mongodb-adapter@next instead of @next-auth/mongodb-adapter. The @next package is very old.

  "dist-tags": {
    "experimental": "0.0.2-pr.274-8c5c0fd1.289",
    "latest": "1.1.1",
    "next": "0.0.2-next.298"
  },

I think the issue still subsists with @next-auth/mongodb-adapter.

If you install mongodb via npm i mongodb, you get the current version (5.0.1) which doesn't work well with mongodb-adapter.

To reproduce, start a sveltekit application, install mongodb then install @next-auth/mongodb-adapter.

chilltemp commented 1 year ago

👍 What you've written looks like a much clearer description of the problem.

bde-maze commented 1 year ago

Hey there! Are you planning on supporting Mongo V5 ?

dlv2372 commented 1 year ago

So, just to get this clear, MongoDB's official NextAuth adapter, which can be found on NextAuth's website https://authjs.dev/reference/adapter/mongodb doesn't work with MongoDB 5.3.0 ? Why isn't that specified somewhere ? I'm not exactly sure where to look.

I'm getting the same kind of error as @Tsabary here, and I can't find any relevant info on Google.

Not sure whether to install the adapter using --legacy-peer-deps, or just rollback my MongoDB install to the latest compatible version, and what version would that be anyway ? Version 4 ? Quite confusing honestly.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: website_test@0.1.0
npm ERR! Found: mongodb@5.3.0
npm ERR! node_modules/mongodb
npm ERR!   mongodb@"^5.3.0" from the root project
npm ERR!   peer mongodb@">=3.4.0" from mongodb-client-encryption@2.7.1
npm ERR!   node_modules/mongodb-client-encryption
npm ERR!     peerOptional mongodb-client-encryption@">=2.3.0 <3" from mongodb@5.3.0
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer mongodb@"^5 | ^4" from @next-auth/mongodb-adapter@1.1.2
npm ERR! node_modules/@next-auth/mongodb-adapter
npm ERR!   @next-auth/mongodb-adapter@"*" from the root project
apeck14 commented 10 months ago

Seems like this is still an active issue, been over a year 🤔

SawkaDev commented 10 months ago

Same issue

ulrich00132 commented 10 months ago

Same issue here. It seems that the problem is NOT important for the Next-Auth team:

"dependencies": { "@next-auth/prisma-adapter": "^1.0.7", "@prisma/client": "^5.1.1", "@react-email/components": "0.0.14", "@stripe/connect-js": "^3.2.0", "@stripe/react-stripe-js": "^2.4.0", "@stripe/stripe-js": "^2.2.2", "@types/node": "20.4.4", "@types/react": "18.2.15", "@types/react-dom": "18.2.7", "autoprefixer": "10.4.14", "axios": "^1.5.0", "bcrypt": "^5.1.1", "date-fns": "^2.30.0", "eslint": "8.45.0", "eslint-config-next": "^14.1.0", "next": "^14.1.0", "next-auth": "^4.24.5", "next-cloudinary": "^4.27.0", "postcss": "8.4.27", "query-string": "^8.1.0", "react": "^18.2.0", "react-date-range": "^1.4.0", "react-dom": "^18.2.0", "react-email": "2.0.0", "react-hook-form": "^7.45.4", "react-hot-toast": "^2.4.1", "react-icons": "^4.10.1", "react-select": "^5.7.5", "resend": "^3.0.0", "stripe": "^14.10.0", "tailwindcss": "3.3.3", "typescript": "^5.3.3", "world-countries": "^5.0.0", "zustand": "^4.4.1" },

TheSupereor commented 1 month ago

Still happening, tried now with version 6.9 of mongodb and still giving errors of dependencies