Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1908

async function* asyncIterator() { - SyntaxError: Unexpected token *

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.2
    • Affects Version/s: next, 3.2.0
    • Component/s: Lambda

      Hi, since the update to 3.2.1, I get this error when I try to start node and it seems related to this code specifically, I do not know how to fix it, any help would be appreciated.

      I am using npm@6.9.0 and node@v8.10.0. (taken from the error log)

      Here is the message when I try to start my node instance.

      /root/294-cms-section-blog-listing-components/node_modules/mongodb/lib/async/async_iterator.js:3
      async function* asyncIterator() {
                    ^
      
      SyntaxError: Unexpected token *
          at createScript (vm.js:80:10)
          at Object.runInThisContext (vm.js:139:10)
          at Module._compile (module.js:616:28)
          at Module._compile (/root/294-cms-section-blog-listing-components/node_modules/pirates/lib/index.js:99:24)
          at Module._extensions..js (module.js:663:10)
          at Object.newLoader [as .js] (/root/294-cms-section-blog-listing-components/node_modules/pirates/lib/index.js:104:7)
          at Module.load (module.js:565:32)
          at tryModuleLoad (module.js:505:12)
          at Function.Module._load (module.js:497:3)
          at Module.require (module.js:596:17)
          at require (internal/module.js:11:18)
          at Object.<anonymous> (/root/294-cms-section-blog-listing-components/node_modules/mongodb/lib/cursor.js:207:44)
          at Module._compile (module.js:652:30)
          at Module._compile (/root/294-cms-section-blog-listing-components/node_modules/pirates/lib/index.js:99:24)
          at Module._extensions..js (module.js:663:10)
          at Object.newLoader [as .js] (/root/294-cms-section-blog-listing-components/node_modules/pirates/lib/index.js:104:7)
          at Module.load (module.js:565:32)
          at tryModuleLoad (module.js:505:12)
          at Function.Module._load (module.js:497:3)
          at Module.require (module.js:596:17)
          at require (internal/module.js:11:18)
          at Object.<anonymous> (/root/294-cms-section-blog-listing-components/node_modules/mongodb/lib/command_cursor.js:7:20)
      npm ERR! code ELIFECYCLE
      npm ERR! errno 1
      npm ERR! graphql-test-server@1.0.0 start: `babel-node index.js --presets @babel/preset-env --plugins @babel/plugin-transform-destructuring,@babel/plugin-syntax-throw-expressions,@babel/plugin-proposal-async-generator-functions,@babel/plugin-transform-async-to-generator`
      npm ERR! Exit status 1
      npm ERR!
      npm ERR! Failed at the graphql-test-server@1.0.0 start script.
      npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
      
      npm ERR! A complete log of this run can be found in:
      npm ERR!     /root/.npm/_logs/2019-03-22T10_51_29_931Z-debug.log}}
      

       

      I even tried to install plugins from babel for async function generators, with no luck, the only way I could get it running was downgrading to 3.1.13.

       

      Until I can figure out what is missing my in package, I can't seem to update to the latest version.

       

      For additional info, here is my package.json.

       

      {
       "name": "graphql-test-server",
       "version": "1.0.0",
       "main": "index.js",
       "scripts": {
           "test": "echo \"Error: no test specified\" && exit 1",
           "start": "babel-node index.js --presets @babel/env --plugins @babel/plugin transform-destructuring,@babel/plugin-syntax-throw-expressions"
       },
       "author": "",
       "license": "ISC",
       "dependencies": {
           "@babel/cli": "^7.2.3",
           "@babel/core": "^7.3.4",
           "@babel/node": "^7.2.2",
           "@babel/plugin-syntax-throw-expressions": "^7.2.0",
           "@babel/plugin-transform-destructuring": "^7.3.2",
           "@babel/polyfill": "^7.2.5",
           "@babel/preset-env": "^7.3.4",
           "apollo-server": "^2.4.8",
           "bcrypt": "^3.0.4",
           "crypto-js": "^3.1.9-1",
           "filestack-js": "^1.14.6",
           "graphql": "^14.1.1",
           "graphql-middleware": "^3.0.2",
           "graphql-shield": "^5.3.0",
           "graphql-tag": "^2.10.1",
           "graphql-tools": "^4.0.4",
           "hashids": "^1.2.2",
           "immutability-helper": "^3.0.0",
           "jsonwebtoken": "^8.5.0",
           "lodash": "^4.17.11",
           "merge-graphql-schemas": "^1.5.8",
           "moment": "^2.24.0",
           "moment-range": "^4.0.2",
           "moment-timezone": "^0.5.23",
           "mongodb": "^3.1.13",
           "node-sass": "^4.11.0",
           "path-to-regexp": "^3.0.0",
           "request": "^2.88.0",
           "simple-recur": "^0.2.0",
           "speakingurl": "^14.0.1",
           "taxjar": "^2.2.0"
       },
       "devDependencies": {},
       "description": ""
      }
      

       

            Assignee:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Reporter:
            kheang.hc Kheang Hok Chin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: