Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token ':' #304

Open
minkuang1982 opened this issue Feb 15, 2024 · 0 comments
Open

SyntaxError: Unexpected token ':' #304

minkuang1982 opened this issue Feb 15, 2024 · 0 comments

Comments

@minkuang1982
Copy link

D:\AI\DingDongBot>node dingdongbot.js
file:///D:/AI/DingDongBot/dingdongbot.js:20
function onScan (qrcode: string, status: ScanStatus) {
^

SyntaxError: Unexpected token ':'
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:167:18)
at callTranslator (node:internal/modules/esm/loader:285:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:30)
at async link (node:internal/modules/esm/module_job:76:21)

Node.js v20.11.0

D:\AI\DingDongBot>node -v
v20.11.0

D:\AI\DingDongBot>npm -v
10.2.4

this is the code same as the example

function onScan (qrcode: string, status: ScanStatus) {
if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) {
const qrcodeImageUrl = [
'https://wechaty.js.org/qrcode/',
encodeURIComponent(qrcode),
].join('')
log.info('StarterBot', 'onScan: %s(%s) - %s', ScanStatus[status], status, qrcodeImageUrl)

qrcodeTerminal.generate(qrcode, { small: true })  // show qrcode on console

} else {
log.info('StarterBot', 'onScan: %s(%s)', ScanStatus[status], status)
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant