Skip to content

SVGO fails with ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows #2140

Closed
@Studio384

Description

@Studio384

Describe the bug
When running SVGO on Windows it will fail due to incorrectly formatted paths.

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:208:11)
    at defaultLoad (node:internal/modules/esm/load:103:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:819:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:590:43)
    at #createModuleJob (node:internal/modules/esm/loader:615:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:343:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:308:41)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:657:25)

To Reproduce
Steps to reproduce the behavior:

  1. Create a svgo.config.mjs file, this happens even with an empty file (export default {}).
  2. Run SVGO, I use the command svgo -f ./icons -o ./icons)

Expected behavior

The command does not fail.

Screenshots

N/A

Desktop (please complete the following information):

  • SVGO Version 4.0.0-rc.4
  • Node.js Version 24.1.0
  • OS: Windows 11, version 10.0.26100.4202

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions