Skip to content

Show QR Code with Docker run wechaty: require('qrcode-teminal') failed #74

@lijiarui

Description

@lijiarui

Run wechaty run doctor and paste the output here

Wechaty Doctor

  1. Wechaty version: 0.5.1
  2. Linux x64 version 3.16.0-4-amd64 memory 292/1000 MB
  3. Docker: true

Expected behavior

print qr-code when "scan" event

Actual behavior

can't print qr-code

Steps to reproduce the behavior (and fixes, if any)

code as follows:

on('scan', (url, code) => {
console.log('test!!!!!!!!!!!!!!!!@@@@@@@@@@@@@@@@@@@@@')
if(!/201|200/.test(String(code))){
let loginUrl = url.replace(//qrcode//, '/l/')
console.log('loginUrl')
console.log(loginUrl)
require('qrcode-terminal').generate(loginUrl)
}
console.log(url)
console.log(code)
console.log('!!!!!!!!!!')
console.log(${url}\n[${code}] Scan QR Code in above url to login: )
})

Paste the full output logs here with WECHATY_LOG=silly set

VERB PuppetWeb init() done
VERB StateMonitor state.current(live,true) <- (live,false) for Puppet
VERB StateMonitor state.current(ready,true) <- (standby,true) for Wechaty
VERB PuppetWebServer createSocketIo() got connection from browser
VERB PuppetWebServer initEventFromClient()
VERB PuppetWebEvent onServerConnection: [object Object]
SILL PuppetWebEvent onServerLog(connectSocket())
SILL PuppetWebEvent onServerLog(connectSocket: io not found. loading lib...)
SILL PuppetWebEvent onServerLog(checkScan() - code change detected: from null to 408)
VERB PuppetWebEvent onServerScan(408)
SILL PuppetWebBrowserCookie save() to file wechatyshow.wechaty.json
SILL PuppetWebBrowserCookie save() saving 3 cookies: pgv_si,pgv_pvi,mm_lang
SILL PuppetWebEvent onServerDing(heartbeat@browser)
SILL PuppetWebWatchdog onFeed: 60000, HEARTBEAT:[heartbeat@browser]
SILL StateMonitor state.target() is live of Puppet
SILL StateMonitor state.inprocess() is false of Puppet
SILL PuppetWebWatchdog clearWatchDogTimer() nothing to clear
SILL PuppetWebWatchdog setWatchDogTimer(60000, HEARTBEAT:[heartbeat@browser])
SILL PuppetWebWatchdog monitorScan(HEARTBEAT)
SILL PuppetWebWatchdog autoSaveSession()
SILL PuppetWebWatchdog memoryCheck() free: 121 MB, require: 16 MB
SILL PuppetWebBrowserCookie save() 3 cookies to wechatyshow.wechaty.json
SILL PuppetWebWatchdog onFeed: 60000, SCAN:[[object Object]]
SILL StateMonitor state.target() is live of Puppet
SILL StateMonitor state.inprocess() is false of Puppet
SILL PuppetWebWatchdog clearWatchDogTimer() [60] seconds left
SILL PuppetWebWatchdog setWatchDogTimer(60000, SCAN:[[object Object]])
SILL PuppetWebWatchdog monitorScan(SCAN)
SILL PuppetWebWatchdog autoSaveSession()
SILL PuppetWebWatchdog memoryCheck() free: 121 MB, require: 16 MB
test!!!!!!!!!!!!!!!!@@@@@@@@@@@@@@@@@@@@@
loginUrl
https://login.weixin.qq.com/l/AfNmqUwD7g==
SILL PuppetWebEvent onServerDing(heartbeat@browser)
SILL PuppetWebWatchdog onFeed: 60000, HEARTBEAT:[heartbeat@browser]
SILL StateMonitor state.target() is live of Puppet
SILL StateMonitor state.inprocess() is false of Puppet
SILL PuppetWebWatchdog clearWatchDogTimer() [46] seconds left

As seen in the log, I got nothing when running console.log(url) and console.log(code) ,even console.log('!!!!!!!!!!') doesn't run.

So I guess, maybe require('qrcode-terminal').generate(loginUrl) occur something wrong

then I run :

npm install qrcode-terminal

then fix

"Scan" event works!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions