Skip to content

Weixin Plugin Load Failure: Missing openclaw Package in Dependencies #54428

@43622283

Description

@43622283

Weixin Plugin Load Failure: Missing openclaw Package in Dependencies

Issue Type

  • Bug Report
  • Feature Request
  • Documentation Issue

Description

The openclaw-weixin plugin fails to load with a module resolution error. The plugin requires the openclaw package at runtime for its SDK imports, but the package is only listed in devDependencies in package.json, causing it to not be installed during normal plugin installation.

Error Message

Error: Cannot find module 'openclaw/plugin-sdk/channel-config-schema'
Require stack:
- /root/.openclaw/extensions/openclaw-weixin/index.ts

Full error log:

18:54:16 [plugins] openclaw-weixin failed to load from /root/.openclaw/extensions/openclaw-weixin/index.ts: 
Error: Cannot find module 'openclaw/plugin-sdk/channel-config-schema'
Require stack:
- /root/.openclaw/extensions/openclaw-weixin/index.ts

Root Cause Analysis

Problematic Code

The plugin's index.ts imports from the openclaw package:

import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry";
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";

package.json Issue

{
  "peerDependencies": {
    "openclaw": ">=2026.3.22"
  },
  "devDependencies": {
    "openclaw": "2026.3.23"
  }
}

The openclaw package is only in devDependencies and peerDependencies. When the plugin is installed:

  • peerDependencies are not automatically installed (by npm design)
  • devDependencies are not installed in production/linked scenarios
  • The plugin's node_modules lacks the openclaw package at runtime

Steps to Reproduce

  1. Install the weixin plugin: openclaw plugins install openclaw-weixin
  2. Start the gateway: openclaw gateway start
  3. Observe plugin load failure in logs

Expected Behavior

The plugin should load successfully after installation, with all required dependencies available.

Actual Behavior

Plugin fails to load due to missing openclaw module.

Environment

Component Version
openclaw 2026.3.23
Node.js v24.14.1
openclaw-weixin 2.0.1
OS Linux (Ubuntu)

Proposed Solutions

Solution 1: Move openclaw to dependencies (Recommended)

{
  "dependencies": {
    "openclaw": ">=2026.3.22",
    "qrcode-terminal": "0.12.0",
    "zod": "4.3.6"
  },
  "devDependencies": {
    "@vitest/coverage-v8": "^3.1.0",
    "silk-wasm": "^3.7.1",
    "typescript": "^5.8.0",
    "vitest": "^3.1.0"
  }
}

Pros:

  • Dependencies are automatically installed
  • Clear indication of runtime requirements
  • Standard npm behavior

Cons:

  • May cause version conflicts if host openclaw version differs

Solution 2: Document Manual Installation Step

Add to plugin README:

cd ~/.openclaw/extensions/openclaw-weixin
npm install

Pros:

  • No code changes required
  • User has control over dependency versions

Cons:

  • Poor user experience
  • Easy to miss during installation

Solution 3: Use Plugin Installation Hook

Create an install.sh script that runs automatically during plugin installation.

Pros:

  • Automated installation
  • Can handle complex setup

Cons:

  • Requires openclaw to support installation hooks
  • Security considerations for running scripts

Temporary Workaround

Run the following commands to fix the issue:

cd ~/.openclaw/extensions/openclaw-weixin
npm install
openclaw gateway restart

Or use the provided fix script:

curl -o weixin-fixed.sh <script-url>
chmod +x weixin-fixed.sh
./weixin-fixed.sh

Files Affected

  • /root/.openclaw/extensions/openclaw-weixin/package.json
  • /root/.openclaw/extensions/openclaw-weixin/index.ts

Additional Context

This issue affects all plugins that:

  1. Import from openclaw/plugin-sdk/* at runtime
  2. Only list openclaw in devDependencies or peerDependencies

The same fix should be applied to any similar plugins in the ecosystem.

Checklist

  • I have searched for existing issues
  • I have included the environment information
  • I have provided steps to reproduce
  • I have proposed potential solutions

Report Date: 2026-03-25
Reporter: Automated Diagnosis Tool

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions