openclaw - ✅(Solved) Fix [Bug]: plugins install does not resolve openclaw peerDependencies — causes plugin startup failure [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70436Fetched 2026-04-23 07:24:51
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
0
Author
Timeline (top)
commented ×2labeled ×2cross-referenced ×1mentioned ×1

Plugins that declare openclaw as a peerDependency fail to start after installation via openclaw plugins install. The openclaw package is not symlinked or otherwise made available in the plugin's node_modules/, causing module resolution failure at runtime.

Error Message

Error: Cannot find package 'openclaw' imported from /Users/zhouxia/.openclaw/extensions/dingtalk-connector/dist/runtime-CAQ2GHj-.mjs 2026-04-23T09:26:46.162+08:00 [dingtalk-connector] [default] startAccount error: Cannot find package 'openclaw' imported from .../runtime-CAQ2GHj-.mjs

Root Cause

After repeated crashes, the channel is in failed (unknown) state, resulting in 404 errors when the bot attempts to send replies. Root Cause Analysis Problematic dependency structure (@dingtalk-real-ai/dingtalk-connector 0.8.18):

Fix Action

Fix / Workaround

按照标准的提法,且用英文 Pros: Works immediately with current install flow Cons: Duplicates openclaw in each plugin's node_modules/, increasing disk usage Solution 3: Document the manual symlink workaround Add to plugin README / install docs:

Pros: No code changes Cons: Poor UX, easy to miss, breaks on every plugin update Temporary Workaround ln -s /opt/homebrew/lib/node_modules/openclaw
~/.openclaw/extensions/dingtalk-connector/node_modules/openclaw openclaw gateway restart

PR fix notes

PR #70462: fix(plugin-sdk): symlink openclaw peerDependencies after plugin install

Description (problem / solution / changelog)

Summary

  • Plugins that declare openclaw as a peerDependency fail at runtime with Cannot find package 'openclaw' because npm never materialises peerDependencies automatically during npm install --omit=dev.
  • The root cause is in src/plugins/install.ts: installPluginFromPackageDir only inspects manifest.dependencies when deciding whether to run npm install (hasDeps) and has no post-install logic to satisfy peerDependencies.
  • Added linkOpenClawPeerDependencies — a post-install step that reads the plugin's peerDependencies, finds the host openclaw package root via resolveOpenClawPackageRootSync, and symlinks the matching package into the plugin's node_modules/.
  • Updated hasDeps to be true when peerDependencies is non-empty so that npm install still runs (and therefore the staged directory is prepared) even for plugins with no regular dependencies.
  • Extended the PackageManifest local type to include peerDependencies?: Record<string, string> so the field is read from the plugin's package.json.

Change Type

  • Bug fix

Scope

  • Integrations

Linked Issue/PR

Closes #70436

  • This PR fixes a bug or regression

Root Cause

Between plugin versions (e.g. dingtalk-connector v0.8.16 → v0.8.18) openclaw was moved from dependencies to peerDependencies. npm does not install peerDependencies in production installs, and the global openclaw directory is not on the plugin's Node.js module resolution path, so the plugin's bundled runtime cannot import openclaw at startup.

Regression Test Plan

Unit: the linkOpenClawPeerDependencies function is pure async logic operating on fs — an existing test fixture in src/infra/install-package-dir.test.ts (which already mocks fs) is the smallest seam to extend. The function is also exercised end-to-end whenever openclaw plugins install is run with a plugin whose package.json declares openclaw in peerDependencies.

User-visible / Behavior Changes

After openclaw plugins install, a symlink <plugin>/node_modules/openclaw → <host-root> is created when the plugin declares openclaw as a peerDependency. No behavior change for plugins that do not declare the peerDependency.

Diagram

N/A

Security Impact

  • No new permissions
  • No secrets handling
  • No new network calls
  • No new command execution
  • Data access scope: symlink creation is scoped to the plugin's own node_modules/ subdirectory within the extensions dir

Repro + Verification

Environment: macOS arm64, Node 20, openclaw 2026.4.21 (global npm install)

Steps:

  1. openclaw plugins install @dingtalk-real-ai/dingtalk-connector
  2. Start a DingTalk channel
  3. Before fix: Cannot find package 'openclaw' imported from .../runtime-CAQ2GHj-.mjs
  4. After fix: plugin starts successfully; node_modules/openclaw symlink is present in the plugin directory

Evidence

Error from issue: Cannot find package 'openclaw' imported from /Users/zhouxia/.openclaw/extensions/dingtalk-connector/dist/runtime-CAQ2GHj-.mjs

After fix, the plugin directory contains node_modules/openclaw -> /opt/homebrew/lib/node_modules/openclaw.

Human Verification

Verified: logic paths for missing peerDependencies field (empty object fallback), missing host root (warn + continue), idempotent re-install (rm before symlink), and plugins with no openclaw peerDependency (early return). Did not verify Windows junction semantics end-to-end on a live Windows machine.

Review Conversations

  • I have replied to or resolved all bot review conversations

Fixes #70436 Closes #54428

Changed files

  • src/plugins/install.test.ts (modified, +104/-0)
  • src/plugins/install.ts (modified, +85/-4)

Code Example

Solution 1: plugins install should auto-link peerDependencies (Recommended)
After installing a plugin, openclaw plugins install should:
Read the plugin's peerDependencies
For each peerDependency, check if a compatible global version is installed
Create a symlink in the plugin's node_modules/ pointing to the global package
This ensures all plugins benefit automatically, without requiring individual plugin maintainers to change their dependency strategy.
Solution 2: Move openclaw back to dependencies
Revert openclaw from peerDependencies back to dependencies in affected plugins (DingTalk connector, weixin, etc.).
回复 曾迪: 
请你参考一下这个Weixin Plugin Load Failure: Missing openclaw Package in Dependencies · Issue #54428 · openclaw/openc

按照标准的提法,且用英文
Pros: Works immediately with current install flow
Cons: Duplicates openclaw in each plugin's node_modules/, increasing disk usage
Solution 3: Document the manual symlink workaround
Add to plugin README / install docs:

ln -s /opt/homebrew/lib/node_modules/openclaw \
  ~/.openclaw/extensions/dingtalk-connector/node_modules/openclaw



Pros: No code changes
Cons: Poor UX, easy to miss, breaks on every plugin update
Temporary Workaround
ln -s /opt/homebrew/lib/node_modules/openclaw \
  ~/.openclaw/extensions/dingtalk-connector/node_modules/openclaw
openclaw gateway restart

Additional Context
This issue affects any plugin that:
Imports from the openclaw package at runtime
Lists openclaw only in peerDependencies (not in dependencies)
Is installed via openclaw plugins install
The same fix applied here would also resolve #54428 and prevent similar issues for future plugins.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Plugins that declare openclaw as a peerDependency fail to start after installation via openclaw plugins install. The openclaw package is not symlinked or otherwise made available in the plugin's node_modules/, causing module resolution failure at runtime.

Steps to reproduce

Error: Cannot find package 'openclaw' imported from /Users/zhouxia/.openclaw/extensions/dingtalk-connector/dist/runtime-CAQ2GHj-.mjs

2026-04-23T09:26:46.162+08:00 [dingtalk-connector] [default] startAccount error: Cannot find package 'openclaw' imported from .../runtime-CAQ2GHj-.mjs 2026-04-23T09:26:46.163+08:00 [dingtalk-connector] [default] channel exited: Cannot find package 'openclaw' imported from .../runtime-CAQ2GHj-.mjs

Expected behavior

After repeated crashes, the channel is in failed (unknown) state, resulting in 404 errors when the bot attempts to send replies. Root Cause Analysis Problematic dependency structure (@dingtalk-real-ai/dingtalk-connector 0.8.18):

{ "dependencies": { "axios": "1.14.0", "dingtalk-stream": "2.1.4", "form-data": "4.0.0", "qrcode-terminal": "0.12.0", "zod": "4.3.6" }, "peerDependencies": { "openclaw": ">=2026.4.9" } }

Actual behavior

The openclaw package was moved from dependencies to peerDependencies between v0.8.16 and v0.8.18. When the plugin is installed via openclaw plugins install: peerDependencies are not automatically installed (by npm design) devDependencies are not installed in production/linked scenarios The globally installed openclaw (at /opt/homebrew/lib/node_modules/openclaw/) is not on Node.js's module resolution path for the plugin directory The plugin's node_modules/ lacks the openclaw package at runtime This is the same root cause as #54428 (weixin plugin), but affects the DingTalk connector in a different way — openclaw was previously in dependencies and worked, then moved to peerDependencies in a minor version bump, breaking existing installations.

OpenClaw version

2026.4.21

Operating system

macOS 25.3.0 (arm64)

Install method

npm global

Model

bailian/kimi-2.6

Provider / routing chain

openclaw -> bailian/kimi-2.6

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Solution 1: plugins install should auto-link peerDependencies (Recommended)
After installing a plugin, openclaw plugins install should:
Read the plugin's peerDependencies
For each peerDependency, check if a compatible global version is installed
Create a symlink in the plugin's node_modules/ pointing to the global package
This ensures all plugins benefit automatically, without requiring individual plugin maintainers to change their dependency strategy.
Solution 2: Move openclaw back to dependencies
Revert openclaw from peerDependencies back to dependencies in affected plugins (DingTalk connector, weixin, etc.).
回复 曾迪: 
请你参考一下这个Weixin Plugin Load Failure: Missing openclaw Package in Dependencies · Issue #54428 · openclaw/openc

按照标准的提法,且用英文
Pros: Works immediately with current install flow
Cons: Duplicates openclaw in each plugin's node_modules/, increasing disk usage
Solution 3: Document the manual symlink workaround
Add to plugin README / install docs:

ln -s /opt/homebrew/lib/node_modules/openclaw \
  ~/.openclaw/extensions/dingtalk-connector/node_modules/openclaw



Pros: No code changes
Cons: Poor UX, easy to miss, breaks on every plugin update
Temporary Workaround
ln -s /opt/homebrew/lib/node_modules/openclaw \
  ~/.openclaw/extensions/dingtalk-connector/node_modules/openclaw
openclaw gateway restart

Additional Context
This issue affects any plugin that:
Imports from the openclaw package at runtime
Lists openclaw only in peerDependencies (not in dependencies)
Is installed via openclaw plugins install
The same fix applied here would also resolve #54428 and prevent similar issues for future plugins.

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The most likely fix is to create a symlink in the plugin's node_modules/ pointing to the global openclaw package to resolve the module resolution failure.

Guidance

  • Check if a compatible global version of openclaw is installed and create a symlink in the plugin's node_modules/ to point to the global package.
  • Consider moving openclaw back to dependencies in affected plugins, but be aware that this may duplicate openclaw in each plugin's node_modules/ and increase disk usage.
  • Document the manual symlink workaround in the plugin README or install docs, but note that this has a poor UX and may break on every plugin update.
  • Verify the fix by checking if the plugin can start successfully after installation via openclaw plugins install.

Example

ln -s /opt/homebrew/lib/node_modules/openclaw \
  ~/.openclaw/extensions/dingtalk-connector/node_modules/openclaw

Then restart the openclaw gateway.

Notes

The issue affects any plugin that imports from the openclaw package at runtime, lists openclaw only in peerDependencies, and is installed via openclaw plugins install. The same fix applied here would also resolve similar issues for future plugins.

Recommendation

Apply the workaround by creating a symlink in the plugin's node_modules/ pointing to the global openclaw package, as this is a more immediate solution that works with the current install flow. However, consider moving openclaw back to dependencies in affected plugins for a more permanent fix.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

After repeated crashes, the channel is in failed (unknown) state, resulting in 404 errors when the bot attempts to send replies. Root Cause Analysis Problematic dependency structure (@dingtalk-real-ai/dingtalk-connector 0.8.18):

{ "dependencies": { "axios": "1.14.0", "dingtalk-stream": "2.1.4", "form-data": "4.0.0", "qrcode-terminal": "0.12.0", "zod": "4.3.6" }, "peerDependencies": { "openclaw": ">=2026.4.9" } }

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: plugins install does not resolve openclaw peerDependencies — causes plugin startup failure [1 pull requests, 2 comments, 3 participants]