openclaw - 💡(How to fix) Fix CLI subcommands broken in Docker: ~29 missing external deps [3 comments, 4 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#48875Fetched 2026-04-08 00:51:35
View on GitHub
Comments
3
Participants
4
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×3subscribed ×1

Error Message

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'nostr-tools' imported from /app/dist/nostr-CnI7DVq6.js

Root Cause

The bundler (tsdown) marks channel-specific packages as external, but the Docker image build does not install them. The gateway process starts fine because its entrypoint doesn't eagerly import these modules. CLI subcommands (agent, etc.) trigger a sync import chain that fails immediately.

Fix Action

Workaround

Use the Gateway HTTP API instead of CLI:

curl -X POST http://localhost:18789/v1/chat/completions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"openclaw:main","messages":[{"role":"user","content":"test"}]}'

Requires gateway.http.endpoints.chatCompletions.enabled: true in config.

Code Example

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'nostr-tools' imported from /app/dist/nostr-CnI7DVq6.js

---

curl -X POST http://localhost:18789/v1/chat/completions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"openclaw:main","messages":[{"role":"user","content":"test"}]}'
RAW_BUFFERClick to expand / collapse

Environment

FieldValue
Imageghcr.io/openclaw/openclaw:main
Version2026.3.14
PlatformDocker (OrbStack, arm64)

Steps to Reproduce

  1. docker pull ghcr.io/openclaw/openclaw:main
  2. Start container (standard compose)
  3. Verify gateway is healthy: docker exec openclaw-agent curl -s http://localhost:18789/health{"ok":true}
  4. Run: docker exec openclaw-agent openclaw agent --message "test"

Expected

CLI processes the command.

Actual

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'nostr-tools' imported from /app/dist/nostr-CnI7DVq6.js

After stubbing nostr-tools, the next missing package surfaces (zca-js, then discord-api-types/v10 ESM mismatch, etc.). ~29 packages are marked external by the bundler but absent from the Docker image.

Missing packages (partial list)

nostr-tools, zca-js, openai, @twurple/api, @twurple/auth, @twurple/chat, @opentelemetry/api, @opentelemetry/sdk-node, @opentelemetry/sdk-metrics, @opentelemetry/sdk-logs, @opentelemetry/sdk-trace-base, @opentelemetry/resources, @opentelemetry/semantic-conventions, @opentelemetry/exporter-*-otlp-proto, @tloncorp/api, @urbit/aura, @pierre/diffs

Root Cause

The bundler (tsdown) marks channel-specific packages as external, but the Docker image build does not install them. The gateway process starts fine because its entrypoint doesn't eagerly import these modules. CLI subcommands (agent, etc.) trigger a sync import chain that fails immediately.

Related Issues

  • #48422 — dist/plugins/runtime/index.js missing (same bundler/Docker gap)
  • #32879 — zca-js missing for Zalo channel

Workaround

Use the Gateway HTTP API instead of CLI:

curl -X POST http://localhost:18789/v1/chat/completions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model":"openclaw:main","messages":[{"role":"user","content":"test"}]}'

Requires gateway.http.endpoints.chatCompletions.enabled: true in config.

extent analysis

Fix Plan

To fix the issue, we need to install the missing packages in the Docker image. We can do this by modifying the Dockerfile to include the installation of these packages.

  • Update the Dockerfile to include the following lines:
# Install missing packages
RUN npm install --save nostr-tools zca-js openai @twurple/api @twurple/auth @twurple/chat @opentelemetry/api @opentelemetry/sdk-node @opentelemetry/sdk-metrics @opentelemetry/sdk-logs @opentelemetry/sdk-trace-base @opentelemetry/resources @opentelemetry/semantic-conventions @opentelemetry/exporter-otlp-proto @tloncorp/api @urbit/aura @pierre/diffs discord-api-types
  • Alternatively, you can also use a package.json file to manage dependencies and install them using npm install.
{
  "dependencies": {
    "nostr-tools": "^1.0.0",
    "zca-js": "^1.0.0",
    "openai": "^1.0.0",
    "@twurple/api": "^1.0.0",
    "@twurple/auth": "^1.0.0",
    "@twurple/chat": "^1.0.0",
    "@opentelemetry/api": "^1.0.0",
    "@opentelemetry/sdk-node": "^1.0.0",
    "@opentelemetry/sdk-metrics": "^1.0.0",
    "@opentelemetry/sdk-logs": "^1.0.0",
    "@opentelemetry/sdk-trace-base": "^1.0.0",
    "@opentelemetry/resources": "^1.0.0",
    "@opentelemetry/semantic-conventions": "^1.0.0",
    "@opentelemetry/exporter-otlp-proto": "^1.0.0",
    "@tloncorp/api": "^1.0.0",
    "@urbit/aura": "^1.0.0",
    "@pierre/diffs": "^1.0.0",
    "discord-api-types": "^1.0.0"
  }
}
  • Then, update the Dockerfile to copy the package.json file and install dependencies:
# Copy package.json
COPY package.json ./

# Install dependencies
RUN npm install

Verification

To verify that the fix worked, you can run the following command:

docker exec openclaw-agent openclaw agent --message "test"

If the command processes successfully, it means that the missing packages have been installed correctly.

Extra Tips

  • Make sure to update the package.json file to include all the required dependencies.
  • You can also use a docker-compose file to manage

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…

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 - 💡(How to fix) Fix CLI subcommands broken in Docker: ~29 missing external deps [3 comments, 4 participants]