I tried to connect the MCP to Claude Code and it failed with ERR_MODULE_NOT_FOUND
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/node_modules/@cmd8/excalidraw-mcp/dist/tools/index' imported from /path/to/node_modules/@cmd8/excalidraw-mcp/dist/index.js
Probably the bug happened because of a mismatch between development tooling and Node.js runtime requirements
// This works in bundlers, fails in Node.js ESM:
import { foo } from './utils/helper'
// Node.js ESM requires:
import { foo } from './utils/helper.js'
Root Cause
The package has an ESM configuration mismatch:
package.json has "type": "module" (ESM mode)
tsconfig.json uses "moduleResolution": "bundler" which allows extensionless
imports
tsc compiles the TypeScript without adding .js extensions
- Node.js ESM requires explicit
.js extensions for relative imports
I tried to connect the MCP to Claude Code and it failed with
ERR_MODULE_NOT_FOUNDError [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/node_modules/@cmd8/excalidraw-mcp/dist/tools/index' imported from /path/to/node_modules/@cmd8/excalidraw-mcp/dist/index.js
Probably the bug happened because of a mismatch between development tooling and Node.js runtime requirements
Root Cause
The package has an ESM configuration mismatch:
package.jsonhas"type": "module"(ESM mode)tsconfig.jsonuses"moduleResolution": "bundler"which allows extensionlessimports
tsccompiles the TypeScript without adding.jsextensions.jsextensions for relative imports