Next.js Discord

Discord Forum

Trouble upgrading to NextJS 15/React 19

Answered
satvrn posted this in #help-forum
Open in Discord
Hello. I've been trying to update to NextJS 15. I'm trying to run the following command:
$ npm i next@rc react@rc react-dom@rc eslint-config-next@rc

However, NPM spits out the following error:
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: lector@0.1.0
npm error Found: react@19.0.0-rc-6f23540c7d-20240528
npm error node_modules/react
npm error   react@"19.0.0-rc-6f23540c7d-20240528" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"19.0.0-rc-f994737d14-20240522" from next@15.0.0-rc.0
npm error node_modules/next
npm error   next@"15.0.0-rc.0" 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.

This is my package.json:
{
  "name": "lector",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.5",
    "@mui/joy": "^5.0.0-beta.36",
    "@supabase/ssr": "^0.3.0",
    "@supabase/supabase-js": "^2.43.4",
    "canvas": "^2.11.2",
    "next": "14.2.3",
    "next-ws": "^1.0.1",
    "pdf-parse-fork": "^1.2.0",
    "pdfjs-dist": "^4.2.67",
    "quirrel": "^1.14.1",
    "react": "^18",
    "react-dom": "^18",
    "react-dropzone": "^14.2.3",
    "react-icons": "^5.2.1",
    "tesseract.js": "^5.1.0",
    "ws": "^8.17.0"
  },
  "devDependencies": {
    "@next/eslint-plugin-next": "^14.2.3",
    "eslint": "^8",
    "eslint-config-next": "14.2.3"
  }
}


What am I doing something wrong? Should I just --force it?
Thanks in advance.
Answered by satvrn
Update: It seems that the problem is @emotion/react and @mui/joy not supporting React 19 yet. It'll have to wait.
View full answer

6 Replies

Baldfaced hornet
What happens if you just run npm i react@rc?
It wasn't really working before, but this time it has upgraded React to v19. Most packages did throw a warning of not being able to resolve the dependencies, but it seemed to go on without forcing it. I'm now trying to see which packages I can upgrade individually.
This is the result of running npm i next@rc:
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: lector@0.1.0
npm error Found: react@19.0.0-rc-f994737d14-20240522
npm error node_modules/react
npm error   react@"^19.0.0-rc-6f23540c7d-20240528" from the root project
npm error   peer react@"19.0.0-rc-f994737d14-20240522" from next@15.0.0-rc.0
npm error   node_modules/next
npm error     next@"15.0.0-rc.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^18.3.1" from react-dom@18.3.1
npm error node_modules/react-dom
npm error   react-dom@"^18" 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.
And here is npm i react-dom@rc:
For completion, here is the current npx next info:
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun, 26 May 2024 01:30:29 +0000
  Available memory (MB): 15329
  Available CPU cores: 12
Binaries:
  Node: 22.2.0
  npm: 10.7.0
  Yarn: 1.22.22
  pnpm: 9.1.3
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: 14.2.3
  react: 19.0.0-rc-6f23540c7d-20240528
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: standalone
Update: It seems that the problem is @emotion/react and @mui/joy not supporting React 19 yet. It'll have to wait.
Answer