Open Yaxdraz opened 4 years ago
You need a async function
to be able to use await
. Look up async/await
wrapper function.
You need a
async function
to be able to useawait
. Look upasync/await
wrapper function.
Don't work.
Code:
- (async function() {
- let account = await db.User.findOne({userID: user.id})
p #{account.description}
- })()
Error:
SyntaxError: Unexpected token (143:7)
at Parser.pp$4.raise (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:2488:13)
at Parser.pp.unexpected (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:623:8)
at Parser.pp.expect (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:617:26)
at Parser.pp$3.parseParenAndDistinguishExpression (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:2043:38)
at Parser.pp$3.parseExprAtom (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:1978:41)
at Parser.pp$3.parseExprSubscripts (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:1872:19)
at Parser.pp$3.parseMaybeUnary (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:1849:17)
at Parser.pp$3.parseExprOps (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:1791:19)
at Parser.pp$3.parseMaybeConditional (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:1774:19)
at Parser.pp$3.parseMaybeAssign (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:1750:19)
at Parser.pp$3.parseExpression (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:1722:19)
at Parser.pp$1.parseStatement (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:777:45)
at Parser.pp$1.parseTopLevel (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:672:23)
at Parser.parse (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:529:15)
at Object.parse (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn/4.0.13/node_modules/acorn/dist/acorn.js:3378:37)
at reallyParse (/rbd/pnpm-volume/549c5828-7472-4601-8db7-45cda2814f52/node_modules/.registry.npmjs.org/acorn-globals/3.1.0/node_modules/acorn-globals/index.js:22:16)
Any updates? It's been more than a year and that's still an issue
Pug Version: 2.0.4
Node Version: 12.0.0 | 12.x
Input Pug
Expected HTML
Additional Comments
Error:
When I add
await
to the pug file it gives an error but it works when I don't add it. Is there a way to fix it?