wechaty / puppet-wechat

Wechaty Puppet Provider for WeChat
https://www.npmjs.com/package/wechaty-puppet-wechat
Apache License 2.0
408 stars 68 forks source link

启动报错-Could not find expected browser (chrome) locally #168

Closed alekye closed 2 years ago

alekye commented 2 years ago

npm install安装正常,启动报错如下: 12:52:28 VERB PuppetLoginMixin start() 12:52:28 VERB PuppetCacheMixin start() 12:52:28 VERB PuppetMemoryMixin start() 12:52:28 VERB PuppetSkeleton start() 12:52:28 VERB PuppetCacheAgent start() 12:52:28 VERB PuppetCacheAgent clear() 12:52:28 VERB PuppetCacheMixin start() "dirty" event listener added 12:52:28 VERB ServiceCtl start() super.start() ... done 12:52:28 VERB ServiceCtl start() this.onStart() ... 12:52:28 VERB PuppetWeChat onStart() with ding-dong-bot 12:52:28 VERB PuppetWeChat initBridge() 12:52:28 VERB PuppetWeChatBridge start() 12:52:28 VERB StateSwitch active(pending) <- (false) 12:52:28 VERB PuppetWeChatBridge initBrowser() 12:52:28 VERB PuppetWeChatBridge initBrowser() with options={"args":["--audio-output-channels=0","--disable-default-apps","--disable-translate","--disable-gpu","--disable-setuid-sandbox","--disable-sync","--hide-scrollbars","--mute-audio","--no-sandbox"],"headless":true} 12:52:29 ERR PuppetWeChatBridge start() exception: Error: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (901912). 12:52:29 VERB StateSwitch inactive(true) <- (false) 12:52:29 ERR PuppetWeChat initBridge() exception: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (901912). 12:52:29 VERB PuppetWeChatBridge stop() 12:52:29 ERR PuppetWeChat initBridge() this.bridge.stop() rejection: Error: no page StarterBot [GError: from(string): Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (901912).] { code: 2, details: undefined }

huan commented 2 years ago

Can you follow https://wechaty.js.org/2021/02/20/google-cloud-shell-tutorials/ and see if it works for you?

alekye commented 2 years ago
const puppeteer = require("puppeteer");
const browserFetcher = puppeteer.createBrowserFetcher();
browserFetcher.download("901912").then((res) => {
    console.log("res === ", res);
});

写了段代码先把chrome下载下来,可以运行了,如下:

StarterBot Starter Bot Started.
13:51:04 VERB PuppetWeChatEvent onScan({code: 0, url: https://login.weixin.qq.com/qrcode/oYSh0vGhRQ==})
13:51:04 VERB PuppetWeChat onStart() throttleQueue.subscribe() new item: [object Object]
StarterBot onScan: %s(%s) - %s Waiting 2 https://wechaty.js.org/qrcode/https%3A%2F%2Flogin.weixin.qq.com%2Fl%2FoYSh0vGhRQ%3D%3D
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▄▀ ▀ ▀█▄▄▀█▄▄█ ▄▄▄▄▄ █
█ █   █ █   █▀   ▀▀ ▄▀█ █   █ █
█ █▄▄▄█ █▄█▀ ▄ ▄▄ ▀▀ ██ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄█ █ █ █▄▀▄▀▄█▄▄▄▄▄▄▄█
█▄  ▄█▀▄▀▄█ ▄ ▄ ██▄ ▀█ ▀▀ ▄▄█ █
█ ▀██ █▄▄   ▄▄ ▄█▀█▀█ ▄▄█▀█▄▄▀█
█▀████▄▄ █ ▄▀ █▄▀▀▄█ █▄▀██▄ ▀▀█
█▀ ▀█▄ ▄█▀▄  █▄▀██▄▄▄▄ ▀  █▄ ▄█
█▄ █▀▀█▄   ▄█▄▄ █▄▀▄▄  █ ▄ ▀ ██
█▄██▄  ▄▄ ▄▀▀██▄▄▄▀▀█▀▀▀▄▀█ ███
██▄████▄█ ▄███▀▀ ▀ ▀▀ ▄▄▄   ▀▀█
█ ▄▄▄▄▄ ██▀ ▀▀▀▀▀▄█ ▄ █▄█  █▄██
█ █   █ █▀▄▄ █▀▀▀▀▄█▀  ▄  ▀▄▄ █
█ █▄▄▄█ █  ▄█ ▀▄█▀█ ▄ ██▄▀▀▄▀▄█
█▄▄▄▄▄▄▄█▄▄▄▄███▄███▄▄▄██▄██▄██
huan commented 2 years ago

Great to know that you have solved this issue by downloading chrome manually.

And I think your code is very useful for other users, thank you very much for the sharing!