next-auth: NextJS 13 Dependency Error
Environment
System:
OS: Linux 5.10 Pengwin 11 (bullseye)
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 12.19 GB / 15.61 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
npmPackages:
next: 13.0.0 => 13.0.0
react: 18.2.0 => 18.2.0
Reproduction URL
none
Describe the issue
I tried to upgrade my existing project to NextJS 13, but got blocker from next-auth package. The error as follows
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: next13@0.1.0
npm ERR! Found: next@13.0.0
npm ERR! node_modules/next
npm ERR! next@"13.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer next@"^12.2.5" from next-auth@4.15.0
npm ERR! node_modules/next-auth
npm ERR! next-auth@"*" 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!
This also happens when installing on newly created project.
How to reproduce
-
Create new NextJS project using
npm
npx create-next-app nextjs13
-
Change directory to the newly created project
cd nextjs13
-
Try to install
next-auth
npm install next-auth
Then got the error mentioned above
Expected behavior
next-auth
can be used on NextJS 13 projects
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 21
- Comments: 16 (6 by maintainers)
Adding
"overrides": { "next-auth": { "next": "13.0.0" } }
to package.json will allow installing without --force or --legacy-peer-depsApologize, yes I can confirm this is an issue, rolling out a fix now 🙌
@ThangHuuVu, would you mind sharing your npm version? npm install fails because next-auth@4.15.0 literally requires next@12:
https://github.com/nextauthjs/next-auth/blob/a787efc6bec26067c75ce22b2f213ddec6fbfa0d/packages/next-auth/package.json#L80-L81
@balazsorban44 @ThangHuuVu any ideas when the update will make it to npm?
@balazsorban44 thank you! do you have understanding when this fix could be released?
Same issue, next@13 is not supported by next-auth@4.15.0. Note: you’ll have to delete
node_modules
andpackage-lock.json
if previously you usednpm i --force
.I tried the reproduction steps but didn’t get any errors 🤔 I also tried to pull our example repo and install, as our example repo has specified
"next": "latest"
dependencies, I also didn’t get any errors 🤷‍♂️When fix release?
@ThangHuuVu it’s working on exact 13, but not on canary, more details: https://github.com/nextauthjs/next-auth/pull/5657#issuecomment-1295162710
Everything works fine for me using yarn but I am getting this warning:
warning " > next-auth@4.15.0" has incorrect peer dependency “next@^12.2.5”.
It may also be helpful to make sure
npx
is using the latestcreate-next-app
version: