Skip to content

"for await" loop throws Syntax Error: Unexpected reserved word#21617

@markbjerke

Description

@markbjerke
  • version 10.5.0
  • Platform Windows 10 Pro

This Code does not recognize "await" with Async Iterator and throws:

asyncfunctioninstall(pkg){functiondoIt(){returnnewPromise((resolve,reject)=>{console.log('install: '+pkg);installPkg(pkg,opts,(err)=>{err ? reject(err) : resolve(pkg);});});}returnawaitdoIt();}asyncfunction*installPackages(items){for(letkeyofitems){letpkg=key+'@'+globalDeps[key];letresult=awaitinstall(pkg);yieldresult;}}try{forawait(letpkgofinstallPackages(items)){console.log(pkg);}}catch(e){console.log(e.stack);}

I was really excited about async generators and installed Node 10.5 but I can't get a thing to work? I tried the --harmony-async-iterator flag but that returns: unsupported flag?

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidIssues and PRs that are invalid.questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions