wangrongding / wechat-bot

🤖一个基于 WeChaty 结合 OpenAi ChatGPT / Kimi / 讯飞等Ai服务实现的微信机器人 ,可以用来帮助你自动回复微信消息,或者管理微信群/好友,检测僵尸粉等...
MIT License
5.16k stars 730 forks source link

❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️❗️ 安装或者运行报错,先看这条 Issue。 #54

Open Riveray-Jiang opened 1 year ago

Riveray-Jiang commented 1 year ago
11:01:09 ERR PuppetWeChatBridge start() exception: Error: An `executablePath` or `channel` must be specified for `puppeteer-core`
11:01:09 ERR PuppetWeChat initBridge() exception: An `executablePath` or `channel` must be specified for `puppeteer-core`
11:01:09 ERR PuppetWeChat initBridge() this.bridge.stop() rejection: Error: no page
GError: An `executablePath` or `channel` must be specified for `puppeteer-core`
    at assert (/Users/I576457/Documents/chatgpt/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:28:15)
    at ChromeLauncher.launch (/Users/I576457/Documents/chatgpt/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:69:36)
    at PuppeteerNode.launch (/Users/I576457/Documents/chatgpt/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PuppeteerNode.js:154:105)
    at PuppeteerExtra.launch (/Users/I576457/Documents/chatgpt/wechat-bot/node_modules/puppeteer-extra/dist/index.cjs.js:128:41)
    at async Bridge.initBrowser (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:109:23)
    at async Bridge.start (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:48:28)
    at async PuppetWeChat.initBridge (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet-wechat/dist/esm/src/puppet-wechat.js:176:13)
    at async PuppetWeChat.onStart (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet-wechat/dist/esm/src/puppet-wechat.js:69:23)
    at async PuppetWeChat.start (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/state-switch/dist/esm/src/service-ctl/service-ctl.js:62:17)
    at async PuppetWeChat.start (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet/dist/esm/src/mixins/service-mixin.js:18:13) {
  code: 2,
  details: 'Error: An `executablePath` or `channel` must be specified for `puppeteer-core`\n' +
    '    at assert (/Users/I576457/Documents/chatgpt/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:28:15)\n' +
    '    at ChromeLauncher.launch (/Users/I576457/Documents/chatgpt/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:69:36)\n' +
    '    at PuppeteerNode.launch (/Users/I576457/Documents/chatgpt/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PuppeteerNode.js:154:105)\n' +
    '    at PuppeteerExtra.launch (/Users/I576457/Documents/chatgpt/wechat-bot/node_modules/puppeteer-extra/dist/index.cjs.js:128:41)\n' +
    '    at async Bridge.initBrowser (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:109:23)\n' +
    '    at async Bridge.start (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet-wechat/dist/esm/src/bridge.js:48:28)\n' +
    '    at async PuppetWeChat.initBridge (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet-wechat/dist/esm/src/puppet-wechat.js:176:13)\n' +
    '    at async PuppetWeChat.onStart (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet-wechat/dist/esm/src/puppet-wechat.js:69:23)\n' +
    '    at async PuppetWeChat.start (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/state-switch/dist/esm/src/service-ctl/service-ctl.js:62:17)\n' +
    '    at async PuppetWeChat.start (file:///Users/I576457/Documents/chatgpt/wechat-bot/node_modules/wechaty-puppet/dist/esm/src/mixins/service-mixin.js:18:13)'
}

大家有遇到过这个问题嘛..

ww-care commented 1 year ago

有,感觉是puppeteer-core这modules的问题

wangrongding commented 1 year ago

你们都是什么操作系统?方便说一下吗?看到有些小伙伴都出现了这个问题

emmmnaadada commented 1 year ago

你们都是什么操作系统?方便说一下吗?看到有些小伙伴都出现了这个问题

我是用服务器

emmmnaadada commented 1 year ago

你们都是什么操作系统?方便说一下吗?看到有些小伙伴都出现了这个问题

luinx

ww-care commented 1 year ago

mac+node 18

cxp1226 commented 1 year ago

你们都是什么操作系统?方便说一下吗?看到有些小伙伴都出现了这个问题

win11😂

wangrongding commented 1 year ago

mac+node 18

mac+node18也报这个错?

Niomax32 commented 1 year ago

Win10 and node 18, encountered the same issue. Feels like wechaty-puppet-wechat is broken with the latest puppeteer-core, lacking of the executablePath. Forcibly downgrading the puppeteer and puppeteer-core to a deprecated version 13.5.1 made the bot works again for me, just FYI, I don't think this is an elegant solution for this issue,.

Riveray-Jiang commented 1 year ago

你们都是什么操作系统?方便说一下吗?看到有些小伙伴都出现了这个问题

Mac m1 + node v19.2

Riveray-Jiang commented 1 year ago

Win10 and node 18, encountered the same issue. Feels like wechaty-puppet-wechat is broken with the latest puppeteer-core, lacking of the executablePath. Forcibly downgrading the puppeteer and puppeteer-core to a deprecated version 13.5.1 made the bot works again for me, just FYI, I don't think this is an elegant solution for this issue,.

Do you mean to downgrade both puppeteer and puppeteer-core to 13.5.1? I attempted to run after downgrading both packages but failed. Could you go into more detail? :)

yaokuku123 commented 1 year ago

mac m1 + node18

P001water commented 1 year ago

docker 同样是这个错误 :)

OnePieceJoker commented 1 year ago

Win10 and node 18, encountered the same issue. Feels like wechaty-puppet-wechat is broken with the latest puppeteer-core, lacking of the executablePath. Forcibly downgrading the puppeteer and puppeteer-core to a deprecated version 13.5.1 made the bot works again for me, just FYI, I don't think this is an elegant solution for this issue,.

Do you mean to downgrade both puppeteer and puppeteer-core to 13.5.1? I attempted to run after downgrading both packages but failed. Could you go into more detail? :)

我的话是在package.json里指定下特定的版本

"devDependencies": {
      "puppeteer": "13.5.1",
      "puppeteer-core": "13.5.1"
  }

启动后报错,提示下载chromium(macos下), 我就手动配置下了executablePath为modules里面下载好的chromium路径,就可以启动成功了

xiaoqian97 commented 1 year ago

@OnePieceJoker 我就手动配置下了executablePath为modules里面下载好的chromium路径

这个怎么配置的

xiaoqian97 commented 1 year ago

14:22:41 ERR PuppetWeChatBridge start() exception: Error: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (970485). 14:22:41 ERR PuppetWeChat initBridge() exception: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (970485). 14:22:41 ERR PuppetWeChat initBridge() this.bridge.stop() rejection: Error: no page GError: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (970485).

锁定依赖版本就出这个问题

OnePieceJoker commented 1 year ago

你这个报错日志里,顶层有个Launcher.js文件,进入这个文件报错的方法里,然后搜索executablePath,将它修改为你node_modules/puppeteer里下载的Chromium文件路径.

image

OnePieceJoker commented 1 year ago

image 这个路径吗

配置下启动试试

xinyuanlee commented 1 year ago

持续关注中https://github.com/wangrongding/wechat-bot/issues/54#issuecomment-1347823542

OnePieceJoker commented 1 year ago

@zq970825 你这路径不对,你用下绝对路径,到chrome.exe

xinyuanlee commented 1 year ago

微信截图_20221213145603 设置绝对路径貌似也不行,后面不用加chrome.exe吧,加上也不行

yaokuku123 commented 1 year ago

你这个报错日志里,顶层有个Launcher.js文件,进入这个文件报错的方法里,然后搜索executablePath,将它修改为你node_modules/puppeteer里下载的Chromium文件路径.

image

可以了 感谢

wyinbo commented 1 year ago

你这个报错日志里,顶层有一个Launcher.js文件,进入这个文件报错的方法里,然后搜索executablePath,将它修改为你的node_modules/puppeteer里下载的Chromium文件。 图片

可以了 谢谢

微信截图_20221213145603 设置绝对路貌似也不行,后面不用加chrome.exe吧,加上也不行

我这边也不行

Riveray-Jiang commented 1 year ago

我疯狂报429 too many requests,不应该呀?我还没怎么请求呢

chanlk commented 1 year ago

windows 用绝对路径 双反斜杠 \\ 类似于 C:\\aaa\\bbb\\ccc\\chrome.exe

xinyuanlee commented 1 year ago

https://github.com/wangrongding/wechat-bot/issues/54#issuecomment-1347844741 https://github.com/wangrongding/wechat-bot/issues/54#issuecomment-1347809419 可以了,可以了,感谢感谢

wyinbo commented 1 year ago

需要加上chrome.exe ,然后是 / 不是 \,\会被转义的,你改一下再试一下 @wyinbo

image 改了后,还是不行,报错了。 image

wangrongding commented 1 year ago

我直接下了一个 chromium ,然后指定在位置的。

具体步骤: 到这个地址下载一个 chromium 包

先找到你对应的系统架构 https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots 然后我这里用的是 mac arm,970496 版本,为啥要这样,因为它指定的是 970485 这个版本,高版本我试了下没用,但是970485暂时没找到,就用了这个差不多的版本。目前是正常的。 https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots/Mac_Arm/970496/

下载完后,然后在项目目录中打开 node_modules ,找到下方这个文件

绝对路径/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js

改下第 60 行,将其中的executablePath 改为你刚才下载的 chromium 的位置

const { ignoreDefaultArgs = false, args = [], dumpio = false, channel = null, executablePath = '/Users/wangrongding/Coding/wechat-bot/Chromium.app/Contents/MacOS/Chromium', pipe = false, env = process.env, handleSIGINT = true, handleSIGTERM = true, handleSIGHUP = true, ignoreHTTPSErrors = false, defaultViewport = { width: 800, height: 600 }, slowMo = 0, timeout = 30000, waitForInitialPage = true, debuggingPort = null, } = options;

重新启动 npm run dev。就可以了

暂时先这么搞吧,后续看看还有什么好的方案。🥲

OnePieceJoker commented 1 year ago

需要加上chrome.exe ,然后是 / 不是 \,\会被转义的,你改一下再试一下 @wyinbo

image 改了后,还是不行,报错了。 image

@wyinbo 试下@chanlk 说的

windows 用绝对路径 双反斜杠 \\ 类似于 C:\\aaa\\bbb\\ccc\\chrome.exe
ImmortalBro commented 1 year ago

windows系统下 目前是使用绝对路径解决的该问题,其他系统用此方式也大致相同。 image

wyinbo commented 1 year ago

已经好了,谢谢各位

GeniusGGuo commented 1 year ago

为什么我目录下没有那个文件 image

GeniusGGuo commented 1 year ago

我直接下了一个 chromium ,然后指定在位置的。

具体步骤: 到这个地址下载一个 chromium 包

先找到你对应的系统架构 https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots 然后我这里用的是 Mac arm,970496 版本,为啥要这样,因为它指定的是 970485 这个版本,高版本我试了下没用,但是970485暂时没找到,就用了这个差不多的版本。目前是正常的。 https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots/Mac_Arm/970496/

下载完后,然后在项目目录中打开 node_modules ,找到下方这个文件

绝对路径/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js

改下第 60 行,将其中的可执行文件Path 改为你刚才下载的 chromium 的位置

const { ignoreDefaultArgs = false, args = [], dumpio = false, channel = null, executablePath = '/Users/wangrongding/Coding/wechat-bot/Chromium.app/Contents/MacOS/Chromium', pipe = false, env = process.env, handleSIGINT = true, handleSIGTERM = true, handleSIGHUP = true, ignoreHTTPSErrors = false, defaultViewport = { width: 800, height: 600 }, slowMo = 0, timeout = 30000, waitForInitialPage = true, debuggingPort = null, } = options;

重新启动 npm run dev。就可以了

暂时先这么搞吧,后续看看还有什么好的方案。🥲

没有Launcher.js这个文件怎么办

OnePieceJoker commented 1 year ago

@GeniusGGuo 提供下你启动时的报错日志

MissayaA commented 1 year ago

@GeniusGGuo ,参考,我也没有Launcher.js这个文件,但在报错信息中可以看到

GError: An `executablePath` or `channel` must be specified for `puppeteer-core`
    at assert (/home/lighthouse/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:28:15)
    at ChromeLauncher.launch (/home/lighthouse/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:69:36)

然后我在wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js该文件中第30行发现了一样的内容,按照上述提供的方法修改即可。

另外可能会报错wechat-bot/chrome-linux/chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory等缺少.so的信息,安装对应的.so即可 sudo yum install at-spi2-atk libxkbcommon

Pi-char commented 1 year ago

我直接下了一个 chromium ,然后指定在位置的。

具体步骤: 到这个地址下载一个 chromium 包

先找到你对应的系统架构 https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots 然后我这里用的是 mac arm,970496 版本,为啥要这样,因为它指定的是 970485 这个版本,高版本我试了下没用,但是970485暂时没找到,就用了这个差不多的版本。目前是正常的。 https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots/Mac_Arm/970496/

下载完后,然后在项目目录中打开 node_modules ,找到下方这个文件

绝对路径/wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js

改下第 60 行,将其中的executablePath 改为你刚才下载的 chromium 的位置

const { ignoreDefaultArgs = false, args = [], dumpio = false, channel = null, executablePath = '/Users/wangrongding/Coding/wechat-bot/Chromium.app/Contents/MacOS/Chromium', pipe = false, env = process.env, handleSIGINT = true, handleSIGTERM = true, handleSIGHUP = true, ignoreHTTPSErrors = false, defaultViewport = { width: 800, height: 600 }, slowMo = 0, timeout = 30000, waitForInitialPage = true, debuggingPort = null, } = options;

重新启动 npm run dev。就可以了

暂时先这么搞吧,后续看看还有什么好的方案。🥲

可以了!! 不过大家玩的时候尽量用小号吧,今天被微信警告用第三方脚本啥的了....

GeniusGGuo commented 1 year ago

感谢 我改好了 但是现在运行不报错 出现乱码。。。 image

GeniusGGuo commented 1 year ago

@GeniusGGuo 提供下你启动时的报错日志

我能启动了 但是二维码是乱码。。。 image

OnePieceJoker commented 1 year ago

58 今天我也遇到了微信号退出封号的问题,谨慎使用。

OnePieceJoker commented 1 year ago

@GeniusGGuo 提供下你启动时的报错日志

我能启动了 但是二维码是乱码。。。 image

@GeniusGGuo 你这个问题是qrcode-terminal的问题

https://github.com/gtanner/qrcode-terminal/issues/23

GeniusGGuo commented 1 year ago

@GeniusGGuo 提供下你启动时的报错日志

我能启动了 但是二维码是乱码。。。 image

@GeniusGGuo 你这个问题是qrcode-terminal的问题

gtanner/qrcode-terminal#23

哎 搞不好 不搞了

torans commented 1 year ago
const { ignoreDefaultArgs 

我也是,没有找到这个文件

huyouba1 commented 1 year ago
node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js

怎么我的路径下面只有这几个呢?

node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js.map
LaunchOptions.d.ts      LaunchOptions.d.ts.map  LaunchOptions.js        LaunchOptions.js.map
zyk-miao commented 1 year ago
node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js

怎么我的路径下面只有这几个呢?

node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js.map
LaunchOptions.d.ts      LaunchOptions.d.ts.map  LaunchOptions.js        LaunchOptions.js.map

我也是你这样子的

zyk-miao commented 1 year ago
node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js

怎么我的路径下面只有这几个呢?

node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js.map
LaunchOptions.d.ts      LaunchOptions.d.ts.map  LaunchOptions.js        LaunchOptions.js.map

我跑起来了 依赖下边我没找到谷歌 我自己去 https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots/Linux_x64/970485/下载的 我是linux 我改的 /wechat-bot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js 64行 注释了原有的 用的绝对路径就可以了 // let chromeExecutable = executablePath; let chromeExecutable = '/opt/wechat-bot/chrome-linux/chrome';

gaby0669 commented 1 year ago

用yarn安装就可以了

coder-pz commented 1 year ago

我疯狂报429 too many requests,不应该呀?我还没怎么请求呢

这个解决了吗?我也碰到了

winking324 commented 1 year ago

intel 版本的 Mac 下载 https://registry.npmmirror.com/binary.html?path=chromium-browser-snapshots/Mac/970467/ 可用

ajeep8 commented 1 year ago

同样问题:

我疯狂报429 too many requests,不应该呀?我还没怎么请求呢

ChenZhouMing commented 1 year ago

image 这样就可以了

ChenZhouMing commented 1 year ago

你的邮件我已收到,谢谢你的支持。