Skip to content

[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:' #3664

@jaakko-solita

Description

@jaakko-solita

Describe the bug

  1. npm install
  2. npx mf dts

=>

PS C:\tmp\mfdtsbug> npx mf dts
[ Module Federation CLI ] Module Federation v0.11.2

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:239:11)
    at defaultLoad (node:internal/modules/esm/load:120:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:554:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:435:56)
    at new ModuleJob (node:internal/modules/esm/module_job:76:27)
    at #createModuleJob (node:internal/modules/esm/loader:448:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:260:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:241:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:473:23) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

A Windows related bug? My code does not have c:. Tried different node versions, but the error did not go away

Reproduction

https://github.com/jaakko-solita/mfdtsbug

Used Package Manager

npm

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics
    Memory: 11.49 GB / 27.83 GB
  Binaries:
    Node: 22.3.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.1 - C:\Program Files\nodejs\npm.CMD
    bun: 1.2.5 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (134.0.3124.85)
    Internet Explorer: 11.0.22621.3527

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions