Next.js Discord

Discord Forum

Cannot install next-auth with nextjs v14

Answered
Asiatic Lion posted this in #help-forum
Open in Discord
Avatar
Asiatic LionOP
While trying to installing next-auth with latest version of nextjs I got this error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: next-auth@4.24.3
npm ERR! Found: next@14.0.0
npm ERR! node_modules/next
npm ERR! next@"^14.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer next@"^12.2.5 ^13" from next-auth@4.24.3
npm ERR! node_modules/next-auth
npm ERR! peer next-auth@"^4" from @next-auth/prisma-adapter@1.0.7
npm ERR! node_modules/@next-auth/prisma-adapter
npm ERR! @next-auth/prisma-adapter@"^1.0.7" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: next@13.5.6
npm ERR! node_modules/next
npm ERR! peer next@"^12.2.5
^13" from next-auth@4.24.3
npm ERR!   node_modules/next-auth
npm ERR!     peer next-auth@"^4" from @next-auth/prisma-adapter@1.0.7
npm ERR!     node_modules/@next-auth/prisma-adapter
npm ERR!       @next-auth/prisma-adapter@"^1.0.7" 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 resolution error report
While resolving: next-auth@4.24.3
Found: next@14.0.0
node_modules/next
next@"^14.0.0" from the root project

Could not resolve dependency:
peer next@"^12.2.5 ^13" from next-auth@4.24.3
node_modules/next-auth
peer next-auth@"^4" from @next-auth/prisma-adapter@1.0.7
node_modules/@next-auth/prisma-adapter
@next-auth/prisma-adapter@"^1.0.7" from the root project
Conflicting peer dependency: next@13.5.6
node_modules/next
peer next@"^12.2.5
^13" from next-auth@4.24.3
node_modules/next-auth
peer next-auth@"^4" from @next-auth/prisma-adapter@1.0.7
node_modules/@next-auth/prisma-adapter
@next-auth/prisma-adapter@"^1.0.7" from the root project
Answered by joulev
install next-auth v4.24.4
View full answer

13 Replies

Avatar
its not updated yet, use npm install --force or npm install --legacy-peer-deps (i think this works too) as a tempory fix
Avatar
Cape horse mackerel
Or use next-auth@beta while waiting 🙂
Avatar
ahh they have now updated in beta, when i updated this wasn't an option (so, its nice that it has been "fixed" so fast)
wait this is an intresting idea
@/beta will give you do the new version which is a semver major and possibly breaking changes
Avatar
install next-auth v4.24.4
Answer
Avatar
npm install next-auth@4.24.4
they have released this version with updated peerDependencies
Avatar
Cape horse mackerel
I saw on the npm v4.24.4 but couldn't find it on github, on github their latest release was v4.24.3
Avatar
since it's on npm it should be installable
i also only found out about it now after wandering around on npmjs.com
Avatar
Cape horse mackerel
lol 😄
Image
but yeah, they've updated peers
Image