[BUG] npm-distributed plugins fail to resolve dependencies — cache directory lacks node_modules

Status Open
Reported on v2.1.234
Maintainer reply None cached
Activity 0 comments · opened Aug 18, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When installing an npm-distributed plugin via a marketplace, the plugin is copied to ~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/ but without node_modules. Dependencies remain isolated in ~/.claude/plugins/npm-cache/node_modules/.

When the plugin executes from the cache directory, Node.js cannot resolve bare module imports (e.g., import { cli } from "clibuilder") because there's no node_modules in the resolution path.

Cache structure:

~/.claude/plugins/
├── npm-cache/
│   └── node_modules/
│       └── clibuilder/          # ✓ dependency installed here
└── cache/
    └── cyberplace/
        └── buddy-agent-harness/
            └── 0.6.0/
                ├── dist/cli.mjs  # imports "clibuilder"
                └── (no node_modules)  # ✗ can't resolve

What Should Happen?

Plugin dependencies should be resolvable at runtime. Possible fixes:

  • Run plugins directly from npm-cache/node_modules/<package>/ instead of copying to cache
  • Set NODE_PATH to include npm-cache/node_modules/ when executing plugins
  • Symlink or copy node_modules to the cache directory

Error Messages/Logs

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'clibuilder' imported from ~/.claude/plugins/cache/cyberplace/buddy-agent-harness/0.6.0/dist/cli.mjs

Steps to Reproduce

  1. Create/use a marketplace with an npm-distributed plugin that has runtime dependencies:

``json
{
"name": "buddy-agent-harness",
"source": { "source": "npm", "package": "buddy-agent-harness" }
}
``

  1. Install the plugin: /plugin install buddy-agent-harness@<marketplace>
  2. Run any skill or command from the plugin
  3. Error: Cannot find package 'clibuilder'

Note: The plugin buddy-agent-harness version 0.6.0 is published on npm and depends on clibuilder as a runtime dependency.

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

2.1.234 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

The npm-cache correctly installs the plugin and its dependencies:

~/.claude/plugins/npm-cache/package.json:
{
  "dependencies": {
    "buddy-agent-harness": "^0.6.0",
    ...
  }
}

But when copied to the plugin cache for execution, the node_modules are not included or linked.

View original on GitHub ↗