Node + tsx crash: __name is not a function

Node + tsx crash: __name is not a function

This page captures a startup crash you may hit when running OpenClaw from source via Node + tsx, plus practical workarounds.

Symptom

The crash signature is:

TypeError: __name is not a function

Repro (Node-only)

From the OpenClaw source repo root:

node --version
pnpm install
node --import tsx src/entry.ts status

Observed environment (from official debug notes)

  • Node: v25.x (e.g. v25.3.0)
  • tsx: 4.21.0
  • OS: macOS (likely reproducible on other Node 25 platforms)

Likely cause (high level)

The official debug note points to an esbuild/tsx loader path where the __name helper is missing or overwritten at runtime.

Workarounds

Option 1: tsc watch → run compiled output

pnpm exec tsc --watch --preserveWatchOutput
node --watch openclaw.mjs status

Option 2: compile once → run

pnpm exec tsc -p tsconfig.json
node openclaw.mjs status

Option 3: use Bun (if your dev flow supports it)

If your workflow supports Bun-based scripts, prefer that path to avoid tsx loader runtime differences.

Next steps

  • Repro on Node LTS (e.g. 22/24)
  • If it reproduces on LTS, file an upstream issue with a minimal repro script

Source

Derived from the official doc source openclaw/docs/debug/node-issue.md (rewritten and organized for this site).