Next.js Discord

Discord Forum

Installing NextJS Canary w/ React Compiler

Answered
Blanc de Hotot posted this in #help-forum
Open in Discord
Blanc de HototOP
I'm new to web development but want to try NextJS w/ the new React Compiler but don't know how to install it.

I created an app w/ npx create-next-app@latest. Then, I tried to install React Compiler w/ npm install next@canary babel-plugin-react-compiler and got the following error:
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: my-app@0.1.0
npm error Found: react@18.3.1
npm error node_modules/react
npm error   react@"^18" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"19.0.0-rc-06d0b89e-20240801" from next@15.0.0-canary.106
npm error node_modules/next
npm error   next@"15.0.0-canary.106" 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.


I'm not familiar enough with web development, npm, or Next.JS to know how to go about resolving this error. Any help would be appreciated, I'm sure it's a simple solution 🤦
Answered by joulev
You need next rc, react rc and a few extra configuration https://nextjs.org/blog/next-15-rc#react-compiler-experimental
View full answer

7 Replies

Answer
Blanc de HototOP
Okay! Looks like I need to follow the manual installation steps at:
https://rc.nextjs.org/docs/getting-started/installation
Trying to run:
npm install next@rc react@rc react-dom@rc on an empty directory, per the manual installation guide above but am getting a very similar error.
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: undefined@undefined
npm error Found: react@19.0.0-rc-187dd6a7-20240806
npm error node_modules/react
npm error   react@"19.0.0-rc-187dd6a7-20240806" 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.
That’s weird… does it work if you use pnpm?
Haven’t used npm for ages
Blanc de HototOP
Weirdly enough, yes it does
I guess npm is just being screwy?