Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: Cannot set property 'reactRoot' of undefined

I'm developing a frontend for my API using Next JS and Typescript. I have made changes to the code that has caused this a Type Error to occur whenever I attempt to build, run in dev mode or lint.

Usually this would be fairly easy to debug - however the type error is not present in my own files but instead Next JS's:

enter image description here

Any help would be appreciated.

Thanks in advance!


2 Answers

The issue was caused by a version mismatch between react-dom and the other NextJS packages - I'd removed react-dom as a dependency as I was unaware that NextJS depended on it, so when it was added again it downloaded the latest version "^18.0.0" instead of "17.0.2".

Remove next and reinstall it. It will install the latest version of next and correct react version.

npm uninstall next
npm install next
like image 34
Luccin Avatar answered Sep 11 '26 20:09

Luccin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!