乐于分享
好东西不私藏

微信官方接入 OpenClaw?我 10 分钟搞定了,但过程中这几个坑你必须知道

微信官方接入 OpenClaw?我 10 分钟搞定了,但过程中这几个坑你必须知道

微信官方接入 OpenClaw?我 10 分钟搞定了,但过程中这几个坑你必须知道

看到微信官方支持接入 OpenClaw(龙虾),我心想:这不就是一行命令的事?结果...


事情是这样的

作为 OpenClaw 的老用户,我一直在等微信官方接入。看到文档更新那天,我立刻打开终端:

npx -y @tencent-weixin/openclaw-weixin-cli@latest install

啪!报错:

[openclaw-weixin] 未找到 openclaw,请先安装...

我愣了一下——openclaw -V 明明能跑啊?

作为资深 Windows 用户,我秒懂:这脚本有 Unix 偏见


坑 1:安装脚本的"Unix 优越感"

扒开脚本源码,检测逻辑是这样的:

functionwhich(bin{try {return execSync(`which ${bin}`, { encoding"utf-8" }).trim();  } catch {returnnull;  // Windows 用户直接进这里  }}

which 是 Linux/Mac 的命令,PowerShell 不认识。脚本直接判定"你没装 OpenClaw"。

解决: 不跟它较劲,手动安装更可控。

cd C:\Users\Administrator\.openclaw\extensionsnpm init -ynpm install @tencent-weixin/openclaw-weixin-cliopenclaw plugins install "@tencent-weixin/openclaw-weixin"

坑 2:依赖失踪案

插件装完,重启 Gateway,心想稳了。

啪!报错:

[plugins] openclaw-weixin failed to load: Error: Cannot find module 'zod'

openclaw plugins install 只拉代码,依赖不管。就像买了电视,遥控器得自己配。

解决:

cd C:\Users\Administrator\.openclaw\extensions\openclaw-weixinnpm install

坑 3:路径配置盲区

依赖装完,重启,又报错:

[plugins] openclaw-weixin failed to load from .openclaw-install-stage-xxx

两个问题:

  1. 临时目录残留——安装时创建的临时目录没删,Gateway 先加载了它
  2. 路径未配置——openclaw.json 里 plugins.load.paths 没加微信插件路径

解决:

Step 1:清临时目录

Remove-Item -Recurse -Force C:\Users\Administrator\.openclaw\extensions\.openclaw-install-stage-*

Step 2:加加载路径

{"plugins": {"load": {"paths": ["...\\feishu","C:\\Users\\Administrator\\.openclaw\\extensions\\openclaw-weixin"      ]    }  }}

坑 4:权限配置的隐形门槛

终于!二维码出来了!扫码!登录成功!

我在微信上发了条测试消息,然后...

沉默。

查配置发现:QQ 有 "allowFrom": ["*"],飞书有 "dmPolicy": "open"微信啥都没有

Gateway 的默认策略是拒绝,必须显式配置权限。

解决:

{"channels": {"openclaw-weixin": {"enabled"true,"allowFrom": ["*"]    }  }}

完整流程(Windows 专用)

# 1. 进入扩展目录cd C:\Users\Administrator\.openclaw\extensions# 2. 安装 CLI 和插件npm init -ynpm install @tencent-weixin/openclaw-weixin-cliopenclaw plugins install "@tencent-weixin/openclaw-weixin"# 3. 装依赖(关键!)cd openclaw-weixin && npm install && cd ..# 4. 清临时目录Remove-Item -Recurse -Force .openclaw-install-stage-*

编辑 ~/.openclaw/openclaw.json

{"plugins": {"load": {"paths": ["...","C:\\Users\\Administrator\\.openclaw\\extensions\\openclaw-weixin"      ]    }  },"channels": {"openclaw-weixin": {"enabled"true,"allowFrom": ["*"]    }  }}

重启并登录:

openclaw gateway restartopenclaw channels login --channel openclaw-weixin# 扫码,搞定

坑点速查表

症状
原因
解决
坑 1
说找不到 openclaw
which
 不兼容 Windows
手动安装
坑 2
缺 zod 模块
依赖未自动安装
手动 npm install
坑 3
加载失败/找临时目录
路径未配置+残留目录
加路径+清残留
坑 4
扫码成功但不回复
缺 allowFrom
加通道配置

写在最后

整个过程其实就 10 分钟,但如果不了解这些坑,可能得折腾几小时。

微信官方接入 OpenClaw 是个好消息,希望这篇文章能帮你少走弯路。

你的 AI 助手,现在可以接管微信了。


作者:老石2026-03-22