Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS 13 Dependency Error #5650

Closed
indralukmana opened this issue Oct 26, 2022 · 17 comments · Fixed by #5657
Closed

NextJS 13 Dependency Error #5650

indralukmana opened this issue Oct 26, 2022 · 17 comments · Fixed by #5657

Comments

@indralukmana
Copy link

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

  1. Create new NextJS project using npm

    npx create-next-app nextjs13
  2. Change directory to the newly created project

    cd nextjs13
  3. 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

@indralukmana indralukmana added the triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. label Oct 26, 2022
@ThangHuuVu
Copy link
Member

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 🤷‍♂️

@ThangHuuVu ThangHuuVu removed the triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. label Oct 26, 2022
@igordanchenko
Copy link
Contributor

@ThangHuuVu, would you mind sharing your npm version? npm install fails because next-auth@4.15.0 literally requires next@12:

"peerDependencies": {
"next": "^12.2.5",

% node -v
v16.18.0

% npm -v
8.19.2

% npm install next-auth
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: nextjs13@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! 
npm ERR! See /Users/home/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/home/.npm/_logs/2022-10-26T15_42_37_953Z-debug-0.log

@igordanchenko
Copy link
Contributor

It may also be helpful to make sure npx is using the latest create-next-app version:

npx create-next-app@13 nextjs13

@enricoros
Copy link

enricoros commented Oct 26, 2022

Same issue, next@13 is not supported by next-auth@4.15.0.
Note: you'll have to delete node_modules and package-lock.json if previously you used npm i --force.

@raulmarindev
Copy link
Contributor

I also get the error, I believe this won't work unless the peer dependency for next in next-auth is updated.

@RyelBanfield
Copy link

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".

@FullstackJack
Copy link

Sadly, I had to use npm i next-auth --legacy-peer-deps to get the error to "go away", but clearly we need next-auth to officially support Next.js 13.

@HotCustard
Copy link

Adding
"overrides": { "next-auth": { "next": "13.0.0" } }
to package.json will allow installing without --force or --legacy-peer-deps

@ThangHuuVu
Copy link
Member

Apologize, yes I can confirm this is an issue, rolling out a fix now 🙌

@KrallXZ
Copy link

KrallXZ commented Oct 28, 2022

@ThangHuuVu it's working on exact 13, but not on canary, more details:
#5657 (comment)

@sergeyzwezdin
Copy link

@ThangHuuVu when do you plan to rollout next@13 compatible release?

@cobbvanth
Copy link
Contributor

When will this peer dependency be updated?

@timothymiller
Copy link

When fix release?

@sergeyzwezdin
Copy link

@balazsorban44 thank you! do you have understanding when this fix could be released?

@GabrielFerrarini
Copy link

@balazsorban44 @ThangHuuVu any ideas when the update will make it to npm?

@hireshBrem
Copy link

@ThangHuuVu, would you mind sharing your npm version? npm install fails because next-auth@4.15.0 literally requires next@12:

"peerDependencies": {
"next": "^12.2.5",

% node -v
v16.18.0

% npm -v
8.19.2

% npm install next-auth
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: nextjs13@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! 
npm ERR! See /Users/home/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/home/.npm/_logs/2022-10-26T15_42_37_953Z-debug-0.log

Legend!

@ArefAhmadinezhad
Copy link

Adding
"overrides": { "next-auth": "4.24.7" },
to package.json and delete node_modules folder and run npm i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.