I had this error as well.
I had 19 for both react and react-dom. However, the jsx-runtime file referenced in the error had a path in 18.3.1, so even though I had upgraded, it wasn't using the new version. I deleted my lock and node_modules, installed it, and it disappeared.
I use pnpm and have a lot of issues with versions actually updating and being used.