openclaw - ✅(Solved) Fix [Bug]: Missing dependencies for extensions (Feishu, Nostr) in global install 2026.4.21 [1 pull requests, 8 comments, 8 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#70198Fetched 2026-04-23 07:27:55
View on GitHub
Comments
8
Participants
8
Timeline
14
Reactions
0
Timeline (top)
commented ×8cross-referenced ×2labeled ×2closed ×1

When installing and running openclaw globally via npm, the application crashes due to missing dependencies required by some built-in extensions (Feishu, Nostr).

These dependencies are not installed automatically, causing runtime errors.

Error Message

Error: Cannot find module '@larksuiteoapi/node-sdk' Error: Cannot find module 'nostr-tools'

Root Cause

When installing and running openclaw globally via npm, the application crashes due to missing dependencies required by some built-in extensions (Feishu, Nostr).

These dependencies are not installed automatically, causing runtime errors.

Fix Action

Fixed

PR fix notes

PR #70245: fix(extensions): lazy-load optional deps (feishu, nostr) to prevent global install crashes #70198

Description (problem / solution / changelog)

Summary

  • Problem: Global installs crash at startup due to missing optional dependencies required by bundled extensions (Feishu, Nostr)
  • Why it matters: Makes CLI unusable out-of-the-box for users who do not install optional SDKs
  • What changed: Refactored extensions to lazily load optional dependencies instead of importing them at module load time
  • What did NOT change (scope boundary): No changes to extension APIs, configuration, or dependency declarations

Change Type (select all)

  • Bug fix
  • Refactor required for the fix

Scope (select all touched areas)

  • Integrations

Linked Issue/PR

  • Closes #70198
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: Extensions used top-level require() calls for optional dependencies, causing Node to resolve them during module load
  • Missing detection / guardrail: No runtime checks or lazy-loading mechanism for optional dependencies
  • Contributing context: Extension loader eagerly imports all extensions at startup, making optional dependencies effectively mandatory

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:

    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: Extension initialization / CLI startup

  • Scenario the test should lock in: Install CLI globally without optional dependencies → start CLI → no crash

  • Why this is the smallest reliable guardrail: Failure occurs at runtime during extension loading, not within isolated units

  • Existing test that already covers this (if any): None

  • If no new test is added, why not: Requires environment-level simulation of missing dependencies


User-visible / Behavior Changes

  • CLI no longer crashes when optional extension dependencies are not installed
  • Extensions gracefully disable themselves when dependencies are missing

Diagram (if applicable)

Before:
startup → load extensions → require() optional deps → crash ❌

After:
startup → load extensions → lazy load deps → skip if missing → continue ✅

## Security Impact (required)

- New permissions/capabilities? No  
- Secrets/tokens handling changed? No  
- New/changed network calls? No  
- Command/tool execution surface changed? No  
- Data access scope changed? No  

---

## Repro + Verification

### Environment

- OS: Arch Linux x86_64 
- Kernel: 6.19.11-arch1-1
- Runtime/container: Node v22 .22.2
- Model/provider: N/A  
- Integration/channel (if any): Feishu, Nostr  
- Relevant config (redacted): default install (no optional deps installed  

### Steps

1. Install CLI globally: `npm install -g openclaw`  
2. Run `openclaw`  
3. Observe startup behavior  

### Expected

- CLI starts successfully  
- Optional extensions remain inactive if dependencies are missing  

### Actual

- CLI crashes with `MODULE_NOT_FOUND` (before fix)  

---

## Evidence

- [x] Runtime error reproduced before fix  
- [x] CLI starts successfully after fix  

---

## Human Verification (required)

- Verified scenarios:
  - global install without optional dependencies  
  - extension initialization does not crash  
  - features work when dependencies are present  

- Edge cases checked:
  - missing single dependency  
  - missing all optional dependencies  

- What you did **not** verify:
  - all platform combinations  
  - bundled distribution edge cases  

---

## Review Conversations

- [ ] I replied to or resolved every bot review conversation I addressed in this PR.  
- [ ] I left unresolved only the conversations that still need reviewer or maintainer judgment.  

---

## Compatibility / Migration

- Backward compatible? Yes  
- Config/env changes? No  
- Migration needed? No  

---

## Risks and Mitigations

- Risk:  
  Lazy loading may mask missing dependency errors until runtime usage  

  - Mitigation:  
    Explicit error handling and graceful fallback ensures predictable behavior  

---

## Summary of Changes

- Replaced top-level imports in Feishu and Nostr extensions with lazy-loading logic  
- Added guarded loaders for optional dependencies  
- Ensured extensions disable gracefully when dependencies are unavailable  
- Fixed scoping issues introduced during refactor (Nostr helper placement)  
- Cleaned up types and lint issues to satisfy strict pre-commit hooks  

---

## Technical Details

### Feishu Extension

- Implemented `loadFeishuSdkSync()` using `createRequire(import.meta.url)`  
- Preserves synchronous API surface while deferring module resolution  
- Deferred SDK side-effects (e.g., User-Agent patching) until successful load  
- Introduced `MissingOptionalDependencyError` for controlled failure handling  

### Nostr Extension

- Implemented hybrid loader:
  - `await import()` for ESM + test compatibility (Vitest mocking)  
  - fallback to `require()` for runtime environments  

- Added normalization layer to handle:
  - ESM namespace imports  
  - `.default` export variations  

- Fixed scoping issue by relocating `sendEncryptedDm` inside runtime closure  

### Design Considerations

- Avoided top-level imports to prevent eager dependency resolution  
- Maintained compatibility with:
  - ESM environments  
  - CommonJS runtime  
  - Vitest mocking behavior  

---

## Testing Performed

- Ran local test suites → all passing  
- Ran TypeScript checks (`pnpm tsgo`) → no errors  
- Verified CLI startup:
  - without optional dependencies → no crash  
  - with dependencies installed → functionality intact

## Changed files

- `src/commands/doctor-config-flow.ts` (modified, +5/-0)
- `src/config/io.ts` (modified, +24/-12)
- `src/flows/doctor-health-contributions.ts` (modified, +125/-1)
RAW_BUFFERClick to expand / collapse
<img width="982" height="389" alt="Image" src="https://github.com/user-attachments/assets/d55e978f-ea80-42fd-bd09-baada29cc013" />

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

When installing and running openclaw globally via npm, the application crashes due to missing dependencies required by some built-in extensions (Feishu, Nostr).

These dependencies are not installed automatically, causing runtime errors.

Steps to reproduce

Install openclaw globally: npm install -g openclaw Run openclaw Observe errors like: Error: Cannot find module '@larksuiteoapi/node-sdk' Require stack: ...openclaw/dist/extensions/feishu/...

and:

Error: Cannot find module 'nostr-tools' Require stack: ...openclaw/dist/extensions/nostr/...

Expected behavior

All required dependencies for bundled extensions should be installed automatically, or optional extensions should not be loaded unless explicitly enabled.

Actual behavior

The app crashes at runtime due to missing modules required by extensions that are enabled by default.

OpenClaw version

2026.4.21

Operating system

windows 11

Install method

iwr -useb https://openclaw.ai/install.ps1 | iex

Model

minimax 2.5 opencode

Provider / routing chain

opencode

Additional provider/model setup details

OS: Windows (PowerShell) Node.js version: v24.14.0 npm version: 11.9.0 Installation method: global (npm install -g openclaw)

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The most likely fix is to ensure that all required dependencies for built-in extensions are installed automatically or to disable optional extensions that are not needed.

Guidance

  • Verify the package.json file of the openclaw project to ensure that dependencies like @larksuiteoapi/node-sdk and nostr-tools are listed.
  • Check the installation script (install.ps1) to see if it handles the installation of these dependencies.
  • Consider modifying the openclaw application to only load extensions that are explicitly enabled or to provide an option to install required dependencies separately.
  • Review the documentation for openclaw to see if there are any specific instructions for installing dependencies for built-in extensions.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The issue seems to be related to the installation process of openclaw and its dependencies. The provided information does not include the exact code or scripts used for installation, so a more detailed analysis is not possible.

Recommendation

Apply workaround: Modify the openclaw application to handle missing dependencies for built-in extensions, either by installing them automatically or by providing an option to disable optional extensions. This is because the issue is related to the installation process and dependencies, and a workaround can help mitigate the problem until a more permanent fix is available.

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

All required dependencies for bundled extensions should be installed automatically, or optional extensions should not be loaded unless explicitly enabled.

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]: Missing dependencies for extensions (Feishu, Nostr) in global install 2026.4.21 [1 pull requests, 8 comments, 8 participants]