wechat-bot icon indicating copy to clipboard operation
wechat-bot copied to clipboard

🟡🟡🟡 安装或者运行报错,先看这条 Issue。🟡🟡🟡

Open Riveray-Jiang opened this issue 2 years ago • 139 comments

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)'
}

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

Riveray-Jiang avatar Dec 13 '22 03:12 Riveray-Jiang

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

ww-care avatar Dec 13 '22 03:12 ww-care

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

wangrongding avatar Dec 13 '22 03:12 wangrongding

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

我是用服务器

emmmnaadada avatar Dec 13 '22 03:12 emmmnaadada

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

luinx

emmmnaadada avatar Dec 13 '22 03:12 emmmnaadada

mac+node 18

ww-care avatar Dec 13 '22 03:12 ww-care

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

win11😂

cxp1226 avatar Dec 13 '22 03:12 cxp1226

mac+node 18

mac+node18也报这个错?

wangrongding avatar Dec 13 '22 04:12 wangrongding

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,.

Niomax32 avatar Dec 13 '22 04:12 Niomax32

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

Mac m1 + node v19.2

Riveray-Jiang avatar Dec 13 '22 04:12 Riveray-Jiang

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? :)

Riveray-Jiang avatar Dec 13 '22 05:12 Riveray-Jiang

mac m1 + node18

yaokuku123 avatar Dec 13 '22 05:12 yaokuku123

docker 同样是这个错误 :)

P001water avatar Dec 13 '22 06:12 P001water

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路径,就可以启动成功了

OnePieceJoker avatar Dec 13 '22 06:12 OnePieceJoker

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

这个怎么配置的

xiaoqian97 avatar Dec 13 '22 06:12 xiaoqian97

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).

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

xiaoqian97 avatar Dec 13 '22 06:12 xiaoqian97

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

image

OnePieceJoker avatar Dec 13 '22 06:12 OnePieceJoker

image 这个路径吗

配置下启动试试

OnePieceJoker avatar Dec 13 '22 06:12 OnePieceJoker

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

xinyuanlee avatar Dec 13 '22 06:12 xinyuanlee

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

OnePieceJoker avatar Dec 13 '22 06:12 OnePieceJoker

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

xinyuanlee avatar Dec 13 '22 06:12 xinyuanlee

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

image

可以了 感谢

yaokuku123 avatar Dec 13 '22 07:12 yaokuku123

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

可以了 谢谢

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

我这边也不行

wyinbo avatar Dec 13 '22 07:12 wyinbo

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

Riveray-Jiang avatar Dec 13 '22 07:12 Riveray-Jiang

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

chanlk avatar Dec 13 '22 07:12 chanlk

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

xinyuanlee avatar Dec 13 '22 07:12 xinyuanlee

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

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

wyinbo avatar Dec 13 '22 07:12 wyinbo

我直接下了一个 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。就可以了

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

wangrongding avatar Dec 13 '22 07:12 wangrongding

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

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

@wyinbo 试下@chanlk 说的

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

OnePieceJoker avatar Dec 13 '22 08:12 OnePieceJoker

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

ImmortalBro avatar Dec 13 '22 08:12 ImmortalBro

已经好了,谢谢各位

wyinbo avatar Dec 13 '22 08:12 wyinbo