Skip to content

bug: ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows when loading --env config #260

@NathanMolTechno

Description

@NathanMolTechno

Description

Describe the bug

On Windows, running web-codegen-scorer eval --env=config.mjs fails with Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]. This happens because the CLI passes an absolute Windows path (e.g., C:\path\to\config.mjs) directly to a dynamic import(). Node.js ESM loader interprets the C: as an unsupported protocol.

Steps to Reproduce

  1. Use a Windows machine.
  2. Install web-codegen-scorer globally or locally.
  3. Run: web-codegen-scorer eval --env=angular-example
  4. See error: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader.

Error Stack with DEBUG enabled

$ export DEBUG=1&& web-codegen-scorer eval --env=angular-example
An error occurred during the assessment process:
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:187:11)
    at defaultLoad (node:internal/modules/esm/load:82:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:815:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:594:31)
    at #createModuleJob (node:internal/modules/esm/loader:624:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:343:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:311:41)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:664:25)

Environment

  • OS: Windows 11
  • Node version: v22.21.1 (and other ESM-enabled versions). Also tried Node 24
  • Tool version: 0.0.69

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions