Skip to content

Extensions with dependencies fail to load when installed via pnpm (missing node_modules) #26762

@joshjhall

Description

@joshjhall

Bug

Extensions that declare their own dependencies in extensions/<name>/package.json fail to load when OpenClaw is installed via pnpm (global or otherwise), because pnpm does not recursively run npm install inside nested sub-packages.

Reproduction

pnpm add -g [email protected]
# Enable matrix in openclaw.json
openclaw gateway restart

Gateway log:

[plugins] matrix failed to load from .../openclaw/extensions/matrix/index.ts:
Error: Cannot find module '@vector-im/matrix-bot-sdk'

Root Cause

The published openclaw package includes extensions/<name>/package.json with dependencies, but those sub-package node_modules/ directories are not populated. Neither pnpm nor npm recursively install nested package.json files — only the top-level package.json dependency tree is resolved.

This likely works in the development workspace (monorepo/workspaces), but the published tarball does not include the extension node_modules/ and has no postinstall hook to install them.

Affected Extensions (2026.2.24)

Every bundled extension with external dependencies is affected. Of 13 extensions with deps, all 13 ship without their node_modules:

Extension Missing Dependencies
matrix @vector-im/matrix-bot-sdk, @matrix-org/matrix-sdk-crypto-nodejs, markdown-it, music-metadata, zod
diagnostics-otel 11 @opentelemetry/* packages
feishu @larksuiteoapi/node-sdk, @sinclair/typebox, zod
googlechat google-auth-library
memory-lancedb @lancedb/lancedb, @sinclair/typebox, openai
msteams @microsoft/agents-hosting, express
nostr nostr-tools, zod
synology-chat zod
tlon @urbit/aura
twitch @twurple/api, @twurple/auth, @twurple/chat, zod
voice-call @sinclair/typebox, ws, zod
zalo undici
zalouser @sinclair/typebox

Extensions without external dependencies (e.g., telegram, discord, signal, slack, whatsapp, imessage, irc) are unaffected.

Workaround

Manually run npm install inside each affected extension directory:

cd "$(pnpm root -g)/openclaw/extensions/matrix"
npm install

This breaks on every pnpm update since the store contents are replaced.

Suggested Fix

A few options (not mutually exclusive):

  1. Bundle node_modules in the published tarball — ensure the npm publish step includes extension deps
  2. Add a postinstall hook — run npm install in each extension subdirectory that has a package.json with dependencies
  3. Hoist extension deps — move them to the top-level package.json as optional dependencies so any package manager resolves them
  4. Lazy install on enable — have openclaw plugins enable <name> or gateway startup check/install missing deps automatically

Option 3 or 4 seems most robust across package managers.

Environment

  • openclaw 2026.2.24
  • pnpm 10.6.2
  • macOS 26.3 (arm64)
  • Node v24.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    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