Skip to content

Conversation

@EvitanRelta
Copy link
Contributor

Fix ESM path handling on Windows

Issue:
ERR_UNSUPPORTED_ESM_URL_SCHEME error occurs on Windows when validating MCP projects due to non-URL file paths in dynamic import().

Cause:
Windows absolute paths (e.g., C:\...) aren't valid ESM URLs. At https://github.com/QuantGeekDev/mcp-framework/blob/eb3a7bf/src/cli/utils/validate-project.ts#L9-L11, the original code used:

await import(packageJsonPath)

which fails on Windows because ESM requires file:// URLs.

Fix:
Use fs.readFile + JSON.parse instead of dynamic import:

const package_json = JSON.parse(await readFile(packageJsonPath, "utf-8"));

@QuantGeekDev
Copy link
Owner

@EvitanRelta Hey, sorry I missed this! This is great, thanks. Can you add me on Discord to walk through this? Here's our server invite link: https://discord.gg/RMCFtcEuYd

@QuantGeekDev
Copy link
Owner

@EvitanRelta Thanks!

@QuantGeekDev QuantGeekDev merged commit fc506d3 into QuantGeekDev:main Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants