From my understanding, we can obtain this error in any npm project. I got this error when I was working with a React Query project. The issue was launched to the project all of a sudden on a fine day. I had no idea what got changed. For me the error shown in the browser looked weird:

The issue was with the mismatch in package dependencies. I was working with React Query version 3. I then installed React Query Devtools version 2, which in turn required React Query version 2.
"dependencies": {
"react-query": "^3.19.0",
"react-query-devtools": "^2.6.3",
}
When I removed react-query-devtools
and did a clean build, things started working.