From 15116b74d94018a35ee49fc6ca5f51a63681109b Mon Sep 17 00:00:00 2001 From: mofr Date: Fri, 10 Oct 2025 19:15:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Windows=20?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=B8=8B=20dev=20=E8=84=9A=E6=9C=AC=E7=9A=84?= =?UTF-8?q?=20ESM=20=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除 dev 脚本中通过命令行传递的 --onSuccess 参数,避免在 Windows 系统上 因路径格式问题导致 ERR_UNSUPPORTED_ESM_URL_SCHEME 错误。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b601bd3..a0a334e 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "start": "dist/index.js", "start:check": "dist/index.js --check", "start:http": "TRANSPORT=http dist/index.js", - "dev": "npm run build:watch -- --onSuccess \"node dist/index.js\"", + "dev": "npm run build:watch", "dev:bg": "rimraf dev.log && npm run dev > dev.log 2>&1", "cli": "npm run build && npm start --", "inspect": "npx fastmcp inspect src/index.ts", From 768bd654c84d74401ce036da023565a205b359be Mon Sep 17 00:00:00 2001 From: mofr Date: Fri, 10 Oct 2025 19:42:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Windows=20?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=B8=8B=20ESM=20=E5=8A=A8=E6=80=81=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=20JSON=20=E7=9A=84=E8=B7=AF=E5=BE=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 Windows 上,ESM 的 import() 函数需要 file:// URL 格式,而不是绝对路径。 使用 pathToFileURL 将 package.json 的绝对路径转换为正确的 URL 格式。 这修复了运行 `node dist/index.js` 时出现的 ERR_UNSUPPORTED_ESM_URL_SCHEME 错误。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/pkg.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pkg.ts b/src/pkg.ts index 352cb60..0dcb49f 100644 --- a/src/pkg.ts +++ b/src/pkg.ts @@ -1,8 +1,10 @@ import type { PackageJson } from 'types-package-json' +import { pathToFileURL } from 'url' import util from './util.js' const pkgPath = util.resolve('package.json', util.REPO) -const { default: pkg } = await import(pkgPath, { with: { type: 'json' } }) as { default: Partial } +const pkgUrl = pathToFileURL(pkgPath).href +const { default: pkg } = await import(pkgUrl, { with: { type: 'json' } }) as { default: Partial } export default { ...pkg,