Skip to content

Windows: ERR_UNSUPPORTED_ESM_URL_SCHEME 路径兼容错误 #1

@SawanoHao

Description

@SawanoHao

问题描述

在 Windows 系统运行项目时,触发 Node.js ESM 模块加载错误,程序无法启动。

核心错误日志

[openclaw] Uncaught exception: 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:'

附加日志

17:08:08+08:00 [tools] web_search failed: fetch failed
17:08:28+08:00 [ClawXrouter] syncDetect fallback to S1: Internal error: Atomics.wait() failed: timed-out

运行环境

  • 系统:Windows
  • 模块模式:ESM (type: module)

问题根因

项目在 Windows 下使用了原生绝对路径(C:\xxx) 加载 ESM 模块,Node.js ESM 规范不支持 c: 协议,必须使用 file://C:/xxx 格式。

建议修复

  1. 将 Windows 绝对路径统一转换为 file:// 协议格式
  2. 或优先使用相对路径导入模块
  3. 适配 Windows 平台的路径解析逻辑

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions