client = new Client({
authStrategy: new LocalAuth({
clientId: phoneNo,
dataPath: sessionsPath,
}),
webVersionCache: {
type: 'remote',
remotePath:
'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.3000.1014590669-alpha.html',
},
puppeteer: {
headless: true, // or false if you want to see the browser
args: ['--no-sandbox', '--disable-setuid-sandbox'], // other Chromium flags if needed
},
...clientOpts,
})
这是我使用whatsapp-web.js 包初始化客户端的代码
最新提交链接:https://github.com/wppconnect-team/wa-version/commit/bd46ca03c765648e9ce0f788670a788953d63fd8
我尝试了此链接
https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.3000.1014590669-alpha.html
,我希望二维码能够通过,但我收到错误Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
这些文件有某种过期日期(在我的情况下是 2.2412.54.html 文件) 我正在使用 WhatsApp Web Js,我在个人存储库中上传了删除文件,并在我的应用程序中使用了它 但我得到了无限更新页面
但是,对于任何依赖 WhatsApp Web JS 机器人这些文件的人 有一个对我有用的解决方案
从package.json删除当前的whatsapp-web.js 并删除node_module 然后安装这个
npm install github:pedroslopez/whatsapp-web.js#webpack-exodus
这个版本来自 WhatsApp web JS 创建者本人,但在另一个分支上,我不知道它是否稳定,或者是否有未包含的功能,但对于我的用例来说,它工作得很好 即使没有为机器人客户端提供 webVersionCache
this.client = new Client({
puppeteer: {
headless: true,
},
authStrategy: new LocalAuth({
clientId: this.id,
dataPath: this.sessionPath,
}),
})
在我的机器人服务器上工作