Why does @modelcontextprotocol/mcp-inspector fail with ERR_MODULE_NOT_FOUND for commander under pnpm?
Installing
@modelcontextprotocol/mcp-inspector0.17.1 withpnpmand runningmcp-inspectorfails withError [ERR_MODULE_NOT_FOUND]: Cannot find package 'commander' imported from node_modules/.pnpm/@modelcontextprotocol+inspector@0.17.1_@types+node@24.7.2_typescript@5.9.3/node_modules/@modelcontextprotocol/inspector/cli/build/cli.js. Why does this only happen with strict package managers like pnpm? Is there a fix for the v1 package?Originally asked on GitHub: https://github.com/modelcontextprotocol/inspector/issues/873
5 answers
Status: closed as not planned. The v1 inspector line is deprecated and frozen, so this packaging bug will not be fixed in v1; maintainers said v1 gets security fixes only and asked anyone still seeing it in v2 to open a fresh issue, since v2 is a complete rewrite.
Root cause: the published package's root
package.jsonis missing five runtime dependencies that its bundled files import directly —commander,cors,express,express-rate-limit, andserve-handler.npmhides this because it hoists dependencies to a shared top-levelnode_modules, whilepnpmonly symlinks declared dependencies, producingERR_MODULE_NOT_FOUNDforcommander. One reporter saw the same issue in hoisted monorepos with an older, incompatiblecommander; another saw it appear after upgrading frompnpm@10topnpm@11, speculating that pnpm 11 is stricter.No workaround is confirmed in the thread. Suggestions (unverified) were: add the missing deps to a top-level
package.json(e.g."commander": "^13.1.0"), change thebinfield to point at the CLI's installed binary, or restructure the published package to depend oncli/serverinstead of bundling copies. A contributor said they'd open a PR adding the five missing dependencies, but the thread doesn't show it merged or released.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Installed
@modelcontextprotocol/mcp-inspector0.17.1 withpnpmand ranmcp-inspector; it failed withERR_MODULE_NOT_FOUND: Cannot find package 'commander'pointing atcli/build/cli.js.Source: https://github.com/modelcontextprotocol/inspector/issues/873 (opens external site)
Did this work for you?What @herakles-dev tried on GitHub (Outcome unclear)
A contributor identified five missing runtime deps (
commander,cors,express,express-rate-limit,serve-handler) and said they'd submit a PR; no merge or release is mentioned in the thread.Did this work for you?What @shane-js tried on GitHub (Outcome unclear)
A user reported the same bug also breaks hoisted monorepos when their existing
commanderversion is incompatible; no fix was provided.Did this work for you?What @antony tried on GitHub (Outcome unclear)
A user reported the failure appears when upgrading from
pnpm@10topnpm@11, speculating that pnpm 11 is stricter; no workaround was provided.Did this work for you?
Related questions
- MCP Inspector 0.10.2 sends null for unset optional params (error -32602)?
- Why does npx @modelcontextprotocol/inspector fail with 'mcp-inspector: command not found' after 0.10.0?
- How do I increase MCP Inspector's 10-second request timeout?
- MCP Inspector crashes with 'Controller is already closed' on fastmcp Streamable HTTP
- Why does the MCP Inspector Docker container refuse connections on localhost:6274, and how do I fix it?