NextJS 15 - React 18 or 19?
Unanswered
Oak apple gall wasp posted this in #help-forum
Oak apple gall waspOP
The docs say react 19 is minimum version required. When I use react 18 in my package json, my builds run fine. When I use 19, my builds fail with a bunch of random errors.
I have run all the codemods, and I dont think there is a context error present. What do I do?
I have run all the codemods, and I dont think there is a context error present. What do I do?
TypeError: Cannot read properties of null (reading 'useContext')Resolving 'react-dom/package.json' in /Users/jpetrillo/Documents/Projects/tarkov-directory/node_modules/next/dist/build for build dependencies doesn't lead to expected result '/Users/jpetrillo/Documents/Projects/tarkov-directory/node_modules/react-dom/package.json', but to '/Users/jpetrillo/Documents/Projects/tarkov-directory/node_modules/next/node_modules/react-dom/package.json' instead. Resolving dependencies are ignored for this path.Resolving 'react/package.json' in /Users/jpetrillo/Documents/Projects/tarkov-directory/node_modules/next/dist/build for build dependencies doesn't lead to expected result '/Users/jpetrillo/Documents/Projects/tarkov-directory/node_modules/react/package.json', but to '/Users/jpetrillo/Documents/Projects/tarkov-directory/node_modules/next/node_modules/react/package.json' instead. Resolving dependencies are ignored for this path.18 Replies
It must be because of breaking changes of React v19
https://react.dev/blog/2024/04/25/react-19-upgrade-guide#breaking-changes
I would recommend you to stay at Next.js v14
https://react.dev/blog/2024/04/25/react-19-upgrade-guide#breaking-changes
I would recommend you to stay at Next.js v14
Oak apple gall waspOP
I ran the codemods and skimmed the breaking changes. Nothing should be broken, its strange
Not only your codebase but what about the libraries you are using?
Oak apple gall waspOP
true, but shouldnt I be getting a peer dep error if they are requiring a specific react version?
Maybe bun is not good at that
yeah I assumed you installed by
--force or --legacy-peer-depsOak apple gall waspOP
Nope, just "bun install"
I am going to try npm
yeah, try with npm
Oak apple gall waspOP
yeah then probably that must be the issue I think
Oak apple gall waspOP
used
bunx check-peer-dependencies for anyone else that comes across thisfor what, are you upgrading Next.js v15?
Oak apple gall waspOP
also installed
19.0.0-rc-02c0e824-20241028 as exact version next wanted (I guess I was on a different rc version)@James4u for what, are you upgrading Next.js v15?
Oak apple gall waspOP
Just to upgrade since they said it was stable
well, I won't be using Next.js 15 for my production
React 19 is not stable yet, most of libraries are not compatible with React 19
I would say v15 will be "stable" when they release v16 🤣