'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!



Solution 1:[1]

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".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 EightiethPeak