Running tests fails with ERR_REQUIRE_ESM on Windows
Author: notaskhalsaCreated Dec 23, 2025Updated Jan 8, 2026
I ran the test suite on a clean clone using Node 18 on Windows and encountered an ERR_REQUIRE_ESM error originating from Vitest/Vite before making any changes. Let me know if there’s a recommended workaround for Windows environments.
The complete error was: Error [ERR_REQUIRE_ESM]: require() of ES Module C:\ .......\yup\node_modules\vite\dist\node\index.js from C:\ ..........\yup\node_modules\vitest\dist\config.cjs not supported. Instead change the require of index.js in C:\ ...........\yup\node_modules\vitest\dist\config.cjs to a dynamic import() which is available in all CommonJS modules.
Source: jquense/yup