After updating Node to version 22, I also encountered this error. It happened in a React Native project, in Next.js, and while running an Express server. I tried almost all the solutions suggested on forums but finally found the cause in my setup. At one point, I had installed Node on my Mac M1 using the installer, and it was version 20, which is typically placed in /usr/local/bin/node. Recently, I updated to version 22 via Homebrew, which installs Node for Apple Silicon Macs in /opt/homebrew/bin/node. It turned out that version 20 was still in /usr/local/bin/node, while version 22 was at /opt/homebrew/bin/node. As far as I understand, the projects were still referencing version 20, even though version 22 was the active one. Deleting version 22 and reverting back to version 20 solved the issue for me. I hope this solution helps someone else!