In monorepo this error can happen when there is multiple vite versions, you need to install the same version, source: https://github.com/vitest-dev/vitest/issues/4048