{"id":113,"date":"2026-03-21T22:47:18","date_gmt":"2026-03-21T14:47:18","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/debug-node-issue\/"},"modified":"2026-03-21T23:08:52","modified_gmt":"2026-03-21T15:08:52","slug":"debug-node-issue","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/debug-node-issue\/","title":{"rendered":"Node + tsx \u5d29\u6e83"},"content":{"rendered":"<h1>Node + tsx \u5d29\u6e83<\/h1>\n<h1>Node + tsx &#8220;__name is not a function&#8221; \u5d29\u6e83<\/h1>\n<h2>\u6982\u8ff0<\/h2>\n<p>\u901a\u8fc7 Node \u4f7f\u7528 <code>tsx<\/code> \u8fd0\u884c OpenClaw \u65f6\uff0c\u542f\u52a8\u9636\u6bb5\u62a5\u9519\uff1a<\/p>\n<pre><code>[openclaw] Failed to start CLI: TypeError: __name is not a function\n    at createSubsystemLogger (...\/src\/logging\/subsystem.ts:203:25)\n    at ...\/src\/agents\/auth-profiles\/constants.ts:25:20\n<\/code><\/pre>\n<p>\u6b64\u95ee\u9898\u5728\u5f00\u53d1\u811a\u672c\u4ece Bun \u5207\u6362\u5230 <code>tsx<\/code> \u540e\u51fa\u73b0\uff08\u63d0\u4ea4 <code>2871657e<\/code>\uff0c2026-01-06\uff09\u3002\u76f8\u540c\u7684\u8fd0\u884c\u8def\u5f84\u5728 Bun \u4e0b\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n<h2>\u73af\u5883<\/h2>\n<ul>\n<li>Node: v25.x\uff08\u5728 v25.3.0 \u4e0a\u89c2\u5bdf\u5230\uff09<\/li>\n<li>tsx: 4.21.0<\/li>\n<li>\u64cd\u4f5c\u7cfb\u7edf: macOS\uff08\u5176\u4ed6\u8fd0\u884c Node 25 \u7684\u5e73\u53f0\u4e5f\u53ef\u80fd\u590d\u73b0\uff09<\/li>\n<\/ul>\n<h2>\u590d\u73b0\u6b65\u9aa4\uff08\u4ec5 Node\uff09<\/h2>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<\/p>\n<h1>\u5728\u4ed3\u5e93\u6839\u76ee\u5f55<\/h1>\n<p>node &#8211;version<br \/>\npnpm install<br \/>\nnode &#8211;import tsx src\/entry.ts status<\/p>\n<pre><code>\n## \u4ed3\u5e93\u5185\u6700\u5c0f\u590d\u73b0\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\nnode --import tsx scripts\/repro\/tsx-name-repro.ts\n<\/code><\/pre>\n<h2>Node \u7248\u672c\u68c0\u67e5<\/h2>\n<ul>\n<li>Node 25.3.0\uff1a\u5931\u8d25<\/li>\n<li>Node 22.22.0\uff08Homebrew <code>node@22<\/code>\uff09\uff1a\u5931\u8d25<\/li>\n<li>Node 24\uff1a\u5c1a\u672a\u5b89\u88c5\uff0c\u9700\u8981\u9a8c\u8bc1<\/li>\n<\/ul>\n<h2>\u8bf4\u660e \/ \u5047\u8bbe<\/h2>\n<ul>\n<li><code>tsx<\/code> \u4f7f\u7528 esbuild \u8f6c\u6362 TS\/ESM\u3002esbuild \u7684 <code>keepNames<\/code> \u4f1a\u751f\u6210\u4e00\u4e2a <code>__name<\/code> \u8f85\u52a9\u51fd\u6570\uff0c\u5e76\u7528 <code>__name(...)<\/code> \u5305\u88f9\u51fd\u6570\u5b9a\u4e49\u3002<\/li>\n<li>\u5d29\u6e83\u8868\u660e <code>__name<\/code> \u5b58\u5728\u4f46\u5728\u8fd0\u884c\u65f6\u4e0d\u662f\u51fd\u6570\uff0c\u8fd9\u610f\u5473\u7740\u5728 Node 25 \u7684\u52a0\u8f7d\u5668\u8def\u5f84\u4e2d\u8be5\u8f85\u52a9\u51fd\u6570\u7f3a\u5931\u6216\u88ab\u8986\u76d6\u3002<\/li>\n<li>\u5176\u4ed6 esbuild \u4f7f\u7528\u8005\u4e5f\u62a5\u544a\u8fc7\u7c7b\u4f3c\u7684 <code>__name<\/code> \u8f85\u52a9\u51fd\u6570\u7f3a\u5931\u6216\u88ab\u91cd\u5199\u7684\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h2>\u56de\u5f52\u5386\u53f2<\/h2>\n<ul>\n<li><code>2871657e<\/code>\uff082026-01-06\uff09\uff1a\u811a\u672c\u4ece Bun \u6539\u4e3a tsx\uff0c\u4f7f Bun \u6210\u4e3a\u53ef\u9009\u9879\u3002<\/li>\n<li>\u5728\u6b64\u4e4b\u524d\uff08Bun \u8def\u5f84\uff09\uff0c<code>openclaw status<\/code> \u548c <code>gateway:watch<\/code> \u5747\u6b63\u5e38\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n<h2>\u89e3\u51b3\u65b9\u6cd5<\/h2>\n<ul>\n<li>\u5f00\u53d1\u811a\u672c\u4f7f\u7528 Bun\uff08\u5f53\u524d\u4e34\u65f6\u56de\u9000\u65b9\u6848\uff09\u3002<\/li>\n<li>\u4f7f\u7528 Node + tsc watch\uff0c\u7136\u540e\u8fd0\u884c\u7f16\u8bd1\u4ea7\u7269\uff1a<br \/>\n  <code>bash  theme={\"theme\":{\"light\":\"min-light\",\"dark\":\"min-dark\"}}<br \/>\n  pnpm exec tsc --watch --preserveWatchOutput<br \/>\n  node --watch openclaw.mjs status<\/code><\/li>\n<li>\u5df2\u5728\u672c\u5730\u786e\u8ba4\uff1a<code>pnpm exec tsc -p tsconfig.json<\/code> + <code>node openclaw.mjs status<\/code> \u5728 Node 25 \u4e0a\u53ef\u6b63\u5e38\u8fd0\u884c\u3002<\/li>\n<li>\u5982\u679c\u53ef\u80fd\uff0c\u5728 TS \u52a0\u8f7d\u5668\u4e2d\u7981\u7528 esbuild \u7684 keepNames\uff08\u9632\u6b62\u63d2\u5165 <code>__name<\/code> \u8f85\u52a9\u51fd\u6570\uff09\uff1btsx \u76ee\u524d\u4e0d\u63d0\u4f9b\u6b64\u914d\u7f6e\u9879\u3002<\/li>\n<li>\u5728 Node LTS\uff0822\/24\uff09\u4e0a\u6d4b\u8bd5 <code>tsx<\/code>\uff0c\u786e\u8ba4\u8be5\u95ee\u9898\u662f\u5426\u4e3a Node 25 \u7279\u6709\u3002<\/li>\n<\/ul>\n<h2>\u53c2\u8003\u8d44\u6599<\/h2>\n<ul>\n<li><a href=\"https:\/\/opennext.js.org\/cloudflare\/howtos\/keep_names\">https:\/\/opennext.js.org\/cloudflare\/howtos\/keep_names<\/a><\/li>\n<li><a href=\"https:\/\/esbuild.github.io\/api\/#keep-names\">https:\/\/esbuild.github.io\/api\/#keep-names<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/evanw\/esbuild\/issues\/1031\">https:\/\/github.com\/evanw\/esbuild\/issues\/1031<\/a><\/li>\n<\/ul>\n<h2>\u540e\u7eed\u6b65\u9aa4<\/h2>\n<ul>\n<li>\u5728 Node 22\/24 \u4e0a\u590d\u73b0\uff0c\u786e\u8ba4\u662f\u5426\u4e3a Node 25 \u56de\u5f52\u95ee\u9898\u3002<\/li>\n<li>\u6d4b\u8bd5 <code>tsx<\/code> nightly \u7248\u672c\uff0c\u6216\u5728\u5b58\u5728\u5df2\u77e5\u56de\u5f52\u65f6\u56fa\u5b9a\u5230\u65e9\u671f\u7248\u672c\u3002<\/li>\n<li>\u5982\u679c\u5728 Node LTS \u4e0a\u4e5f\u80fd\u590d\u73b0\uff0c\u5219\u5411\u4e0a\u6e38\u63d0\u4ea4\u5305\u542b <code>__name<\/code> \u5806\u6808\u8ddf\u8e2a\u7684\u6700\u5c0f\u590d\u73b0\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Node + tsx \u5d29\u6e83 Node + tsx &#8220;__name is not a functio [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":1,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"predecessor-version":[{"id":408,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/113\/revisions\/408"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}