{"id":366,"date":"2026-05-29T10:42:02","date_gmt":"2026-05-29T02:42:02","guid":{"rendered":"https:\/\/www.alearnerlin.top\/?p=366"},"modified":"2026-05-29T15:25:34","modified_gmt":"2026-05-29T07:25:34","slug":"%e4%b8%ad%e6%96%87%e7%94%a8%e6%88%b7%e5%90%8d%e5%ae%89%e8%a3%85openclaw%e5%bc%95%e5%8f%91%e7%9a%84%e8%a1%80%e6%a1%88","status":"publish","type":"post","link":"https:\/\/www.alearnerlin.top\/index.php\/2026\/05\/29\/%e4%b8%ad%e6%96%87%e7%94%a8%e6%88%b7%e5%90%8d%e5%ae%89%e8%a3%85openclaw%e5%bc%95%e5%8f%91%e7%9a%84%e8%a1%80%e6%a1%88\/","title":{"rendered":"\u4e2d\u6587\u7528\u6237\u540d\u5b89\u88c5OpenClaw\u5f15\u53d1\u7684\u8840\u6848"},"content":{"rendered":"<h1>\u4e00\u4e2a\u4e2d\u6587\u7528\u6237\u540d\u5f15\u53d1\u7684\u8840\u6848\uff1aWindows \u7f16\u7801\u95ee\u9898\u6392\u67e5\u5b9e\u5f55<\/h1>\n<h2>\u4e00\u53e5\u8bdd\u603b\u7ed3<\/h2>\n<p>Windows \u8ba1\u5212\u4efb\u52a1\u7528 GBK \u7f16\u7801\u8bfb UTF-8 \u6587\u4ef6\uff0c\u4e2d\u6587\u7528\u6237\u540d\u53d8\u6210\u4e71\u7801\uff0cNode.js \u627e\u4e0d\u5230\u6a21\u5757\uff0c\u7f51\u5173\u542f\u52a8\u5931\u8d25\u3002<\/p>\n<hr \/>\n<h2>\u73b0\u8c61\uff1a\u7f51\u5173\u6b7b\u6d3b\u8fde\u4e0d\u4e0a<\/h2>\n<p>\u6211\u5728\u5b89\u88c5 OpenClaw \u7684 Gateway \u670d\u52a1\u65f6\uff0c\u5b89\u88c5\u5411\u5bfc\u63d0\u793a\uff1a<\/p>\n<pre><code>\u25c7  Gateway service installed.\nHealth check failed: connect ECONNREFUSED 127.0.0.1:18789<\/code><\/pre>\n<p>\u7aef\u53e3 18789 \u8fde\u63a5\u88ab\u62d2\u7edd\u3002\u5178\u578b\u7684\u201c\u670d\u52a1\u6ca1\u8d77\u6765\u201d\u3002<\/p>\n<p>\u5b89\u88c5\u7a0b\u5e8f\u81ea\u52a8\u521b\u5efa\u4e86\u4e00\u4e2a Windows \u8ba1\u5212\u4efb\u52a1 <code>OpenClaw Gateway<\/code>\uff0c\u7528\u5b83\u5728\u540e\u53f0\u62c9\u8d77 Node.js \u7f51\u5173\u8fdb\u7a0b\u3002\u4efb\u52a1\u521b\u5efa\u6210\u529f\u4e86\uff0c\u4f46\u8fdb\u7a0b\u663e\u7136\u6ca1\u8dd1\u8d77\u6765\u3002<\/p>\n<p>\u65b0\u624b\u7b2c\u4e00\u53cd\u5e94\uff1a\u662f\u4e0d\u662f\u914d\u7f6e\u6587\u4ef6\u5199\u9519\u4e86\uff1f\u662f\u4e0d\u662f\u9632\u706b\u5899\u62e6\u4e86\uff1f\u662f\u4e0d\u662f\u7aef\u53e3\u51b2\u7a81\u4e86\uff1f<\/p>\n<hr \/>\n<h2>\u6392\u67e5\u7b2c\u4e00\u5c42\uff1a\u914d\u7f6e\u6587\u4ef6\u3001\u9632\u706b\u5899\u3001\u7aef\u53e3<\/h2>\n<p>\u5148\u770b\u914d\u7f6e\u6587\u4ef6 <code>openclaw.json<\/code>\uff1a<\/p>\n<pre><code class=\"language-json\">{\n  &quot;gateway&quot;: {\n    &quot;port&quot;: 18789,\n    &quot;bind&quot;: &quot;loopback&quot;,\n    &quot;mode&quot;: &quot;local&quot;\n  }\n}<\/code><\/pre>\n<p>\u7aef\u53e3 18789\uff0c\u7ed1\u5b9a 127.0.0.1\uff0c\u8ba4\u8bc1 token \u4e5f\u914d\u4e86\u3002<strong>\u914d\u7f6e\u6ca1\u95ee\u9898\u3002<\/strong><\/p>\n<p>\u518d\u770b\u7aef\u53e3\u5360\u7528\uff1a<\/p>\n<pre><code>> netstat -ano | findstr 18789\n\uff08\u7a7a\uff09<\/code><\/pre>\n<p>\u6ca1\u4eba\u76d1\u542c\u3002\u9632\u706b\u5899\u662f loopback \u901a\u4fe1\uff0c\u6839\u672c\u4e0d\u8fc7\u9632\u706b\u5899\u3002<strong>\u6392\u9664\u3002<\/strong><\/p>\n<hr \/>\n<h2>\u6392\u67e5\u7b2c\u4e8c\u5c42\uff1a\u624b\u52a8 vs \u8ba1\u5212\u4efb\u52a1<\/h2>\n<p>\u8bd5\u8bd5\u624b\u52a8\u8dd1\uff1a<\/p>\n<pre><code>> node &quot;C:\\Users\\\u4e00\u751f\u53ea\u7231\u6b6a\u8116\u5b50\u6811\\...\\openclaw\\dist\\index.js&quot; gateway --port 18789\n\n[gateway] loading configuration\u2026\n[gateway] resolving authentication\u2026\n[gateway] starting...<\/code><\/pre>\n<p>\u4e09\u79d2\u5c31\u8d77\u6765\u4e86\uff0c\u7aef\u53e3\u76d1\u542c\u6b63\u5e38\uff0c\u5065\u5eb7\u68c0\u67e5 200 OK\u3002<\/p>\n<p><strong>\u624b\u52a8\u542f\u52a8\u6b63\u5e38\uff0c\u8ba1\u5212\u4efb\u52a1\u542f\u52a8\u5931\u8d25 \u2014 \u95ee\u9898\u9501\u5b9a\u5728\u8ba1\u5212\u4efb\u52a1\u7684\u6267\u884c\u73af\u5883\u4e0a\u3002<\/strong><\/p>\n<p>\u770b\u8ba1\u5212\u4efb\u52a1\u72b6\u6001\uff1a<\/p>\n<pre><code>TaskName     : OpenClaw Gateway\nState        : Ready\nLastTaskResult: 1          \u2190 \u9000\u51fa\u7801 1\uff0c\u5931\u8d25\u4e86<\/code><\/pre>\n<hr \/>\n<h2>\u6392\u67e5\u7b2c\u4e09\u5c42\uff1a\u76f4\u63a5\u8dd1\u811a\u672c\u770b\u62a5\u9519<\/h2>\n<p>\u8ba1\u5212\u4efb\u52a1\u5b9e\u9645\u6267\u884c\u7684\u662f\u4e00\u4e2a <code>.cmd<\/code> \u811a\u672c\uff1a<\/p>\n<pre><code class=\"language-batch\">@echo off\nset &quot;OPENCLAW_GATEWAY_PORT=18789&quot;\n&quot;C:\\Program Files\\nodejs\\node.exe&quot; ^\n  &quot;C:\\Users\\\u4e00\u751f\u53ea\u7231\u6b6a\u8116\u5b50\u6811\\AppData\\Roaming\\npm\\node_modules\\openclaw\\dist\\index.js&quot; ^\n  gateway --port 18789<\/code><\/pre>\n<p>\u5728 cmd \u7a97\u53e3\u91cc\u76f4\u63a5\u8dd1\u8fd9\u4e2a\u811a\u672c\uff1a<\/p>\n<pre><code>Error: Cannot find module &#039;C:\\Users\\\u6d93\u20ac\u9422\u71b7\u5f67\u9416\u8fa8\u74d1\u9474\u6827\u74d9\u93cd\u616dAppData\\...&#039;<\/code><\/pre>\n<p><strong>\u4e71\u7801\uff01<\/strong> \u4e2d\u6587\u7528\u6237\u540d <code>\u4e00\u751f\u53ea\u7231\u6b6a\u8116\u5b50\u6811<\/code> \u53d8\u6210\u4e86 <code>\u6d93\u20ac\u9422\u71b7\u5f67\u9416\u8fa8\u74d1\u9474\u6827\u74d9\u93cd<\/code>\u3002<\/p>\n<hr \/>\n<h2>\u6839\u56e0\uff1aWindows \u7f16\u7801\u673a\u5236\u7684\u7ecf\u5178\u5751<\/h2>\n<p>\u8fd9\u80cc\u540e\u662f Windows \u4e24\u5c42\u7f16\u7801\u4f53\u7cfb\u7684\u8001\u95ee\u9898\uff1a<\/p>\n<h3>\u7b2c\u4e00\u5c42\uff1a\u6587\u4ef6\u7f16\u7801<\/h3>\n<p><code>gateway.cmd<\/code> \u6587\u4ef6\u672c\u8eab\u662f <strong>UTF-8<\/strong> \u7f16\u7801\u7684\u3002OpenClaw \u5b89\u88c5\u7a0b\u5e8f\u5199\u6587\u4ef6\u65f6\u7528 UTF-8\uff0c\u4e2d\u6587\u5b57\u7b26\u539f\u6837\u4fdd\u5b58\u3002<\/p>\n<h3>\u7b2c\u4e8c\u5c42\uff1a\u7cfb\u7edf\u4ee3\u7801\u9875\uff08System Locale \/ ANSI Code Page\uff09<\/h3>\n<p>Windows \u6709\u4e00\u4e2a\u201c\u975e Unicode \u7a0b\u5e8f\u7684\u8bed\u8a00\u201d\u8bbe\u7f6e\u3002\u4e2d\u6587 Windows \u9ed8\u8ba4\u662f <strong>GBK\uff08CP936\uff09<\/strong>\u3002<\/p>\n<p>\u5f53 Windows \u8ba1\u5212\u4efb\u52a1\u6216\u670d\u52a1\u8fdb\u7a0b\uff08\u5c24\u5176\u662f\u4ee5 SYSTEM \u8d26\u6237\u8fd0\u884c\u65f6\uff09\u8bfb\u53d6\u4e00\u4e2a <code>.cmd<\/code> \u6587\u4ef6\uff0ccmd.exe \u4f7f\u7528\u7cfb\u7edf\u7684 ANSI \u4ee3\u7801\u9875\u6765\u89e3\u91ca\u6587\u4ef6\u5185\u5bb9\u3002<\/p>\n<p>UTF-8 \u7f16\u7801\u7684 <code>\u4e00\u751f\u53ea\u7231\u6b6a\u8116\u5b50\u6811<\/code> \u5b57\u8282\u5e8f\u5217\uff0c\u88ab GBK \u89e3\u7801\u5668\u9519\u8bef\u89e3\u91ca\uff0c\u5c31\u53d8\u6210\u4e86 <code>\u6d93\u20ac\u9422\u71b7\u5f67\u9416\u8fa8\u74d1\u9474\u6827\u74d9\u93cd<\/code>\u3002<\/p>\n<h3>\u5177\u4f53\u673a\u5236\uff1a<\/h3>\n<pre><code>UTF-8 \u5b57\u8282:    E4 B8 80 E7 94 9F ...\nGBK \u89e3\u7801\u540e:    \u6d93   \u20ac   \u9422   \u71b7   ...\nNode \u89e3\u6790:     \u8def\u5f84\u4e0d\u5b58\u5728 \u2192 \u62a5\u9519\u9000\u51fa<\/code><\/pre>\n<p>\u8fd9\u4e0d\u662f bug\uff0c\u662f Windows \u7684\u5386\u53f2\u8bbe\u8ba1\u3002Win32 API \u6709\u4e24\u5957\uff1a<code>CreateFileA<\/code>\uff08ANSI\uff09\u548c <code>CreateFileW<\/code>\uff08Unicode\uff09\u3002\u5f88\u591a\u5e95\u5c42\u7ec4\u4ef6\u9ed8\u8ba4\u8d70 ANSI \u8def\u5f84\u3002<\/p>\n<hr \/>\n<h2>\u4fee\u590d\uff1a\u4e00\u884c\u6539\u52a8<\/h2>\n<p><strong>Before:<\/strong><\/p>\n<pre><code class=\"language-batch\">&quot;C:\\Program Files\\nodejs\\node.exe&quot; C:\\Users\\\u4e00\u751f\u53ea\u7231\u6b6a\u8116\u5b50\u6811\\AppData\\Roaming\\npm\\node_modules\\openclaw\\dist\\index.js gateway --port 18789<\/code><\/pre>\n<p><strong>After:<\/strong><\/p>\n<pre><code class=\"language-batch\">openclaw gateway --port 18789<\/code><\/pre>\n<p><code>openclaw<\/code> \u662f npm \u5168\u5c40\u5b89\u88c5\u7684\u547d\u4ee4\uff0c\u5728 PATH \u91cc\u3002npm \u5b89\u88c5\u65f6\u4f1a\u628a\u53ef\u6267\u884c\u811a\u672c\u5199\u5230 <code>%APPDATA%\\npm\\<\/code>\uff08\u4e5f\u662f\u4e2d\u6587\u8def\u5f84\uff09\uff0c\u4f46 <strong>npm \u81ea\u5df1\u5904\u7406\u4e86\u8def\u5f84\u89e3\u6790<\/strong>\uff0c\u4e0d\u9700\u8981\u5728 .cmd \u6587\u4ef6\u91cc\u786c\u7f16\u7801\u7edd\u5bf9\u8def\u5f84\u3002<\/p>\n<p><strong>\u4efb\u4f55\u80fd\u907f\u514d\u5728\u542f\u52a8\u811a\u672c\u4e2d\u5199\u6b7b\u542b\u975e ASCII \u5b57\u7b26\u7684\u7edd\u5bf9\u8def\u5f84\u7684\u65b9\u6848\u90fd\u7ba1\u7528\u3002<\/strong><\/p>\n<hr \/>\n<h2>\u590d\u76d8\uff1a\u4e3a\u4ec0\u4e48\u8fd9\u4e2a\u95ee\u9898\u6709\u666e\u904d\u610f\u4e49<\/h2>\n<h3>1. \u75c7\u72b6\u4e0e\u6839\u56e0\u8131\u8282<\/h3>\n<p>\u4f60\u770b\u5230\u7684\u662f <code>ECONNREFUSED<\/code>\uff08\u7f51\u7edc\u8fde\u63a5\u88ab\u62d2\uff09\uff0c\u4f46\u6839\u56e0\u662f\u7f16\u7801\u95ee\u9898\u3002\u4e2d\u95f4\u9694\u4e86\u56db\u5c42\uff1a\u7f51\u7edc\u5c42 \u2192 \u8fdb\u7a0b\u5c42 \u2192 \u811a\u672c\u5c42 \u2192 \u7f16\u7801\u5c42\u3002<\/p>\n<h3>2. \u73af\u5883\u5dee\u5f02\u96be\u4ee5\u590d\u73b0<\/h3>\n<ul>\n<li>\u624b\u52a8\u5728\u7ec8\u7aef\u8dd1\uff1a\u4f60\u7684\u7ec8\u7aef\u662f UTF-8\uff0c\u6b63\u5e38<\/li>\n<li>\u8ba1\u5212\u4efb\u52a1\u8dd1\uff1aSYSTEM \u8d26\u6237 + GBK \u4ee3\u7801\u9875\uff0c\u4e71\u7801<\/li>\n<li>\u540c\u6837\u7684\u811a\u672c\uff0c\u4e0d\u540c\u4e0a\u4e0b\u6587\uff0c\u5b8c\u5168\u4e0d\u540c\u7684\u884c\u4e3a<\/li>\n<\/ul>\n<h3>3. \u4e2d\u6587\u5f00\u53d1\u8005\u9ad8\u9891\u8e29\u5751<\/h3>\n<p>\u5168\u7403\u5f00\u53d1\u8005\u4e2d\uff0c\u7528\u975e ASCII \u5b57\u7b26\uff08\u4e2d\u6587\u3001\u65e5\u6587\u3001\u97e9\u6587\u3001\u5e26\u91cd\u97f3\u7684\u62c9\u4e01\u6587\uff09\u505a\u7528\u6237\u540d \/ \u8def\u5f84\u540d\u7684\u4eba\u5360\u6bd4\u5f88\u5927\u3002\u4f46\u5927\u591a\u6570\u5f00\u6e90\u5de5\u5177\u7684\u5f00\u53d1\u8005\u548c\u6d4b\u8bd5\u8005\u7528\u7684\u662f\u7eaf ASCII \u73af\u5883\uff0c\u5bfc\u81f4\u8fd9\u7c7b bug \u5f88\u5bb9\u6613\u6f0f\u5230\u7528\u6237\u4fa7\u3002<\/p>\n<h3>4. \u4e00\u4e2a\u542f\u53d1\u5f0f\u7684\u6392\u67e5\u601d\u8def<\/h3>\n<p>\u5f53\u4f60\u9047\u5230\u201c\u67d0\u79cd\u542f\u52a8\u65b9\u5f0f\u5931\u8d25\u4f46\u624b\u52a8\u542f\u52a8\u6210\u529f\u201d\u7684\u95ee\u9898\u65f6\uff1a<\/p>\n<ul>\n<li>\u5148\u6bd4\u73af\u5883\u53d8\u91cf\uff08<code>set<\/code> \u8f93\u51fa\uff09<\/li>\n<li>\u518d\u770b\u8fd0\u884c\u8d26\u6237\uff08<code>whoami<\/code>\uff09<\/li>\n<li>\u6700\u540e\u6000\u7591\u4e00\u4e0b\u7f16\u7801\uff08chcp \u770b\u4ee3\u7801\u9875\uff09<\/li>\n<\/ul>\n<hr \/>\n<h2>\u4fee\u590d\u540e\u7684\u5b8c\u6574\u72b6\u6001<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u68c0\u67e5\u9879<\/th>\n<th>\u72b6\u6001<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u7aef\u53e3 18789 \u76d1\u542c<\/td>\n<td>\u2705 LISTENING<\/td>\n<\/tr>\n<tr>\n<td>\u5065\u5eb7\u68c0\u67e5 \/health<\/td>\n<td>\u2705 200 OK<\/td>\n<\/tr>\n<tr>\n<td>\u8ba1\u5212\u4efb\u52a1\u542f\u52a8<\/td>\n<td>\u2705 \u6b63\u5e38\u8fd0\u884c<\/td>\n<\/tr>\n<tr>\n<td>\u914d\u7f6e\u6587\u4ef6<\/td>\n<td>\u2705 \u65e0\u9700\u4fee\u6539<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u5982\u679c\u91cd\u6765\u4e00\u6b21\uff0c5 \u5206\u949f\u600e\u4e48\u5b9a\u4f4d\uff1f<\/h2>\n<pre><code>1. netstat -ano | findstr 18789     \u2192 \u7aef\u53e3\u6ca1\u76d1\u542c \u2192 \u8fdb\u7a0b\u6ca1\u8d77\n2. \u624b\u52a8\u8dd1 gateway.cmd               \u2192 \u770b\u62a5\u9519\u4fe1\u606f\n3. \u62a5\u9519\u91cc\u6709\u4e71\u7801                     \u2192 \u7f16\u7801\u95ee\u9898\u9501\u5b9a\n4. \u6539\u811a\u672c\uff0c\u7528 PATH \u547d\u4ee4\u4ee3\u66ff\u5199\u6b7b\u8def\u5f84 \u2192 \u4fee\u597d<\/code><\/pre>\n<p>\u5173\u952e\u662f\u7b2c\u4e8c\u6b65\uff1a<strong>\u624b\u52a8\u8dd1\u4e00\u6b21\u542f\u52a8\u811a\u672c\uff0c\u76f4\u63a5\u770b\u6807\u51c6\u9519\u8bef\u8f93\u51fa<\/strong>\u3002\u5f88\u591a\u65f6\u5019\uff0c\u7b2c\u4e00\u6b65\u5c31\u7834\u6848\u3002<\/p>\n<hr \/>\n<p><em>2026-05-20 \u00b7 \u6848\u4f8b\u590d\u76d8<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u4e2a\u4e2d\u6587\u7528\u6237\u540d\u5f15\u53d1\u7684\u8840\u6848\uff1aWindows \u7f16\u7801\u95ee\u9898\u6392\u67e5\u5b9e\u5f55 \u4e00\u53e5\u8bdd\u603b\u7ed3 Windows \u8ba1\u5212\u4efb\u52a1\u7528 GBK \u7f16 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,5],"tags":[13],"class_list":["post-366","post","type-post","status-publish","format-standard","hentry","category-ai","category-5","tag-openclaw"],"_links":{"self":[{"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/posts\/366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/comments?post=366"}],"version-history":[{"count":1,"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/posts\/366\/revisions"}],"predecessor-version":[{"id":367,"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/posts\/366\/revisions\/367"}],"wp:attachment":[{"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/media?parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/categories?post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alearnerlin.top\/index.php\/wp-json\/wp\/v2\/tags?post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}