next.js: Cannot install @next/third-parties in Next.js 15

Link to the code that reproduces this issue

https://github.com/zakuni/reproduction-app

To Reproduce

$ npx create-next-app@latest

$ npm install @next/third-parties@latest next@latest

npm install @next/third-parties@canary next@canary
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: next15@0.1.0
npm error Found: react@19.0.0-rc-65a56d0e-20241020
npm error node_modules/react
npm error   react@"19.0.0-rc-65a56d0e-20241020" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^18.2.0 || 19.0.0-rc-69d4b800-20241021" from next@15.0.1-canary.1
npm error node_modules/next
npm error   next@"15.0.1-canary.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/zakuni/.npm/_logs/2024-10-22T05_24_59_242Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/zakuni/.npm/_logs/2024-10-22T05_24_59_242Z-debug-0.log

Same with @next/third-parties@canary and next@canary

Current vs. Expected behavior

@next/third-parties should be successfully installed.

Provide environment information

Node.js v22.8.0

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.0.0: Tue Sep 24 23:38:45 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8122
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.8.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.0.0 // Latest available version is detected (15.0.0).
  eslint-config-next: 15.0.0
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
  typescript: 5.6.3
Next.js Config:
  output: N/A

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

create-next-app

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

next dev (local)

Additional context

I was trying to upgrade to Next.js 15 from my Next.js 14 project and found the issue. npx @next/codemod@canary upgrade also fail with dependency conflicts. I can complete npm install once with npm install --force, but the next time I run npm install, I get the same error again

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 13
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Trying to upgrade from nextjs 14 using npx @next/codemod@canary upgrade and having the same issue.

@huozhi Upgraded with codemod (npx @next/codemod@canary upgrade latest) and got this again.

npm ERR! Found: react@19.0.0-rc-69d4b800-20241021
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.2.0 || 19.0.0-rc-65a56d0e-20241020" from @next/third-parties@15.0.1

Same issue with the latest canary (15.0.2-canary.7):

Upgrading your project to Next.js 15.0.2-canary.7...

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: project-name@1.0.0
npm error Found: next@15.0.2-canary.7
npm error node_modules/next
npm error   next@"15.0.2-canary.7" from the root project
npm error
npm error Could not resolve dependency:
npm error peer next@"^13.0.0 || ^14.0.0 || ^15.0.0" from @next/third-parties@15.0.2-canary.7
npm error node_modules/@next/third-parties
npm error   @next/third-parties@"15.0.2-canary.7" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/abdonrd/.npm/_logs/2024-10-26T12_42_19_946Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/abdonrd/.npm/_logs/2024-10-26T12_42_19_946Z-debug-0.log
Error: Failed to install dependencies

Will be fixed by #71718

whats the fix?

@huozhi I see that #71718 is merged, but the issue still persists. When can we expect this to be fixed? Are there any decent workarounds?

Having the same issue, loaded the packages with --legacy-peer-deps, but im not sure if this breaks the third parties package. edit: ofcourse this fails when i deploy

package json that i got: “@next/third-parties”: “^15.0.0”, “next”: “15.0.0”, “react”: “19.0.0-rc-65a56d0e-20241020”, “react-dom”: “19.0.0-rc-65a56d0e-20241020”,